[Pyrex] Callbacks from threads and PyGILState_Ensure/PyGILState_Release

Stefan Behnel stefan_ml at behnel.de
Tue Sep 11 21:43:19 CEST 2007


Greg Ewing wrote:
> Ulisses Furquim wrote:
>> Do you mean the option be part of a CFuncDeclaratorNode?
> 
> Something like that, yes. It would be parsed in the
> same place as the exception return value option, and
> attached to the function type descriptor. Then two
> function types would only be considered compatible
> if they had the same value for this option.

The patch I submitted for Cython has not adopted this behaviour. The reasoning
is that two functions can have an identical signature, while one of them
requires the GIL in its implementation and the other one does not (maybe it's
implemented in C-ish code or something). Still, both can be completely
interchangeable, so their signature should not differ.

One of the implications of having different signatures is that a "with GIL"
function would not be assignable to a C function slot (such as a callback
pointer) if Pyrex distinguished between a function "with GIL" and one without
that extension.

See this discussion:

http://comments.gmane.org/gmane.comp.python.cython.devel/18?set_lines=100000

Regards,
Stefan



More information about the Pyrex mailing list