[Cython] 'with gil:' statement

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Wed Mar 16 16:27:40 CET 2011

On 03/16/2011 02:17 PM, Pauli Virtanen wrote:
> Wed, 16 Mar 2011 14:10:29 +0100, Dag Sverre Seljebotn wrote:
>> Ah, right. I guess I agree with disallowing nested "with nogil"
>> statements for the time being then.
> Could you make the inner nested "with nogil" statements no-ops instead,
> if the GIL is already released? Does the Cython compiler keep track if
> GIL is acquired or not?

That's what I initially suggested. See Mark's posted code -- when 
calling another function, you can't know whether the nogil is "nested" 
or not (without actually checking with CPython...)

Within-Cython solutions are bad because calls may cross between 
different Cython modules.


More information about the cython-devel mailing list