[Pyrex] [Cython-dev] Callbacks from threads and PyGILState_Ensure/PyGILState_Release

Ulisses Furquim ulisses.silva at openbossa.org
Sun Sep 23 22:57:29 CEST 2007


Hi,

On 9/22/07, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Then we'd also have to disallow this for now:
>
>     cdef int myfunc() nogil:
>       with GIL:
>           print("something")
>       return 1 + 1
>
> until we can move the decref stuff into the block and can decide if the rest
> of the function is Python code free.

Yes, that's needed and my quick first patch already does that. It's
basically the same behavior as we already have in Cython repository
(using 'with GIL' in the function declaration). Though, it's really a
special case now and just works when 'with GIL' is at the top level of
the function body.

> That makes the "with GIL" block pretty redundant.

Yep, I also think so if we can implement it properly.

Regards,

-- Ulisses



More information about the Pyrex mailing list