[Pyrex] pyrex and GIL

Simon Burton simon at arrowtheory.com
Wed Feb 18 05:01:18 CET 2004


Hi all,
I'm using a "cdef" function as a callback routine for a library
that calls from a different thread.
The callback uses a PyEval_AcquireThread/PyEval_ReleaseThread pair.
So far I've got it to work, sort of.

I'm running into problems to do with exception handling*. It would be nice
to have exceptions work so I can see what's going wrong in the callback.
A try/except doesn't catch anything. The offending call is to a numarray routine.

I may need to have PyEval_ReleaseThread called after
all pyrex's clean up stuff, which is supposed to be called with the GIL held.

Any suggestions/workarounds?

Simon.

* 
Fatal Python error: PyThreadState_Get: no current thread
Got signal 6
[bt] Execution path:
[bt] python(kill+0x11) [0x42028cc1]
[bt] python [0x42028c48]
[bt] python(abort+0x199) [0x4202a019]
[bt] python [0x809bf26]
[bt] python(PyThreadState_Get+0x21) [0x809aa15]
[bt] python(PyErr_Fetch+0xb) [0x808d63b]
[bt] python [0x80617d6]
[bt] python [0x805e76b]
from my callback, after I have released the thread.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 




More information about the Pyrex mailing list