Re: segfault when calling Python from C thread

2005-02-21 Thread Greg Chapman
Fredrik Lundh wrote: > Greg Chapman wrote: > > > Your callback function needs to hold the Python GIL (and have a > > vaild threadstate) before it calls any Python C-API functions. > > Change the last part of it to: > > > >PyGILState_STATE state; > > > >/* ... */ > > > >/* Time to c

Re: segfault when calling Python from C thread

2005-02-20 Thread Fredrik Lundh
Greg Chapman wrote: > Your callback function needs to hold the Python GIL (and have a vaild > threadstate) before it calls any Python C-API functions. Change the > last part of it to: > >PyGILState_STATE state; > >/* ... */ > >/* Time to call the callback */ > >state = PyGILState_

Re: segfault when calling Python from C thread

2005-02-20 Thread Greg Chapman
Travis Berg wrote: > > I'm running into a problem when trying to perform a callback to a > Python function from a C extension. Specifically, the callback is > being made by a pthread that seems to cause the problem. If I call > the callback from the parent process, it works fine. The PyObject

segfault when calling Python from C thread

2005-02-19 Thread Travis Berg
I'm running into a problem when trying to perform a callback to a Python function from a C extension. Specifically, the callback is being made by a pthread that seems to cause the problem. If I call the callback from the parent process, it works fine. The PyObject is static, and holds the same