Bus error in PyGILState_Release (callbacks from other threads)

geoffschmidt at gmail.com geoffschmidt at gmail.com
Tue Jun 20 19:12:54 EDT 2006


geoffschmidt at gmail.com wrote:
> I'm trying to write an extension in C that delivers callbacks to
> Python. The C code starts several threads, and I'd like one of the new
> threads that is started to be able to deliver callbacks to Python. I
> thought I could do this by wrapping the callback function in
> PyGILState_Ensure / PyGILState_Release. When I do this, the Python code
> in the callback in between those two calls certainly works, but when
> PyGILState_Release is called, the process dies with a bus error!

The fine folks on the Pyrex list figured out the problem:
PyEval_InitThreads() needs to be called somewhere before any of the
threading calls are made. For a fixed version of my test program,
please see the Pyrex list archives.

thanks,
Geoff Schmidt
gschmidt [[a t]] gschmidt [[d o t]] org (send correspondence here, not
the address in the header)




More information about the Python-list mailing list