Hi again, Lisandro Dalcin wrote: > The problem: If at the point PyGILState_Release() is called, the GIL > whas not yet created, then the Python (2.3) interpreter segfautls. > > The solution: Call PyEval_InitThread() in the module init function. > But this could have performance impacts for non threaded applications > using a Cython-generated extension module, so this thread > initialization should be done only if needed. A simple approach is to > call PyEval_InitThread() only if the Cython module ever > released/aquired the GIL > > The attached patch implement all the ideas discussed above. Any chance > to this being accepted? Any better idea? Note that PyEval_InitThread() > is a no-op if the GIL is already created.
I'm fine with calling InitThread() when "with nogil" or "with gil" is used anywhere in the source. And I think it should be left to the users to handle all other cases themselves. Also note that UtilityCode() accepts a keyword "init", so you can just put the call to InitThreads() in there and it will do the right thing. I think the "proto" can be dropped completely in this case. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
