[Pyrex] Pyrex Digest, Vol 53, Issue 6

Claudio Freire klaussfreire at gmail.com
Mon Jun 1 18:48:22 CEST 2009


horace wrote:

>    hi,
>    it would be great if i could use c-methods for callbacks but i always get a crash if i access self.
>    am i doing something wrong or doesn't self get assigned correctly if the method gets called from a c-library?

I believe your problem is with the GIL - callbacks could and probably
will be called from either threads without the proper threadlocal
structures initialized in python, or without having acquired the GIL
(global interpreter lock).

You'll have to brows Cython/Pyrex docs, I believe there was a way to
acquire the GIL explicitly but I don't recall the details right now -
or you can use the Python/C API directly from Cython/Pyrex which is
rather simple as well.



More information about the Pyrex mailing list