Author vstinner
Recipients alecsandru.patrascu, catalin.manciu, jtaylor, pitrou, rhettinger, serhiy.storchaka, vstinner
Date 2016-03-10.09:47:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457603261.36.0.840222212626.issue26249@psf.upfronthosting.co.za>
In-reply-to
Content
> Does the API doc say anything about the GIL, for example?

I modified Python to add assert(PyGILState_Check()); in PyMem_Malloc() and other functions.

Sadly, I found a bug in Numpy: Numpy releases the GIL for performance but call PyMem_Malloc() with the GIL released. I proposed a fix:
https://github.com/numpy/numpy/pull/7404

I guess that the fix is obvious and will be quickly merged, but it means that other libraries may have the issue.

Using the issue #26516 (PYTHONMALLOC=debug), we can check PyGILState_Check() at runtime, but there is currently an issue related to sub-interpreters. The assertion fails in support.run_in_subinterp(), function used by test_threading and test_capi for example.
History
Date User Action Args
2016-03-10 09:47:41vstinnersetrecipients: + vstinner, rhettinger, pitrou, jtaylor, serhiy.storchaka, alecsandru.patrascu, catalin.manciu
2016-03-10 09:47:41vstinnersetmessageid: <1457603261.36.0.840222212626.issue26249@psf.upfronthosting.co.za>
2016-03-10 09:47:41vstinnerlinkissue26249 messages
2016-03-10 09:47:41vstinnercreate