[Cython] 'with gil:' statement

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 17 00:24:59 CET 2011

Stefan Behnel wrote:

> I'm not sure if this is a good idea. "nogil" blocks don't have a way to 
> handle exceptions, so simply jumping out of them because an inner 'with 
> gil' block raised an exception can have unexpected side effects.

Seems to me that the __Pyx_WriteUnraisable should be done at
the end of the 'with gil' block, and execution should then
continue from there.

In other words, the effect on exception handling should be
the same as if the 'with gil' block had been factored out into
a separate function having no exception return value.


More information about the cython-devel mailing list