[Cython] 'with gil:' statement

Stefan Behnel stefan_ml at behnel.de
Fri Mar 18 15:05:18 CET 2011

Stefan Behnel, 18.03.2011 13:36:
> We shouldn't forget that basically all Python operations can at least raise
> a MemoryError or a KeyboardInterrupt etc. Most users won't think of these
> cases. I think it would help users in writing safer code if the need to
> handle exceptions in nogil blocks was always made explicit by the compiler.

Oh, and another nice thing to add here: A bare "except" clause can actually 
raise an exception if extracting/instantiating the exception fails. So 
there's really no way for user code to catch all exceptions and there will 
always be unraisable exceptions in code that is technically incapable of 
propagating them.


More information about the cython-devel mailing list