On 28 February 2012 09:54, Stefan Behnel <[email protected]> wrote:
> I'm going to reimplement this, but not for 0.16 anymore, I'd say.

That's ok, I fixed it to not acquire the GIL seeing that control flow
obsoletes None initialization. So you might as well move it into the
setup function if you care, the thing is that that would needlessly
acquire the GIL for the common case (when you have the GIL) in the
tests, so it might slow them down. It would be better to create a
__Pyx_RefNannySetupContextNogil() function wrapper. If you're not
running the code as a test the preprocessor would filter out this
bloat though, so it's really not a very big deal anyway.

> -------- Original-Message --------
> Betreff: Re: [cython-users] What's up with PyEval_InitThreads() in python 2.7?
>
> Mike Cui, 28.02.2012 10:18:
>>> Thanks for the test code, you hadn't mentioned that you use a "with gil"
>>> block. Could you try the latest github version of Cython?
>>>
>>
>> Ahh, much better!
>>
>>   #if CYTHON_REFNANNY
>>   #ifdef WITH_THREAD
>>   __pyx_gilstate_save = PyGILState_Ensure();
>>   #endif
>>   #endif /* CYTHON_REFNANNY */
>>   __Pyx_RefNannySetupContext("callback");
>>   #if CYTHON_REFNANNY
>>   #ifdef WITH_THREAD
>>   PyGILState_Release(__pyx_gilstate_save);
>>   #endif
>>   #endif /* CYTHON_REFNANNY */
>
>
> Hmm, thanks for posting this - it can be further improved. There's no
> reason for code bloat here, it should all just go into the
> __Pyx_RefNannySetupContext() macro.
>
> Stefan
> _______________________________________________
> cython-devel mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/cython-devel
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to