Message261488
> 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. |
|
Date |
User |
Action |
Args |
2016-03-10 09:47:41 | vstinner | set | recipients:
+ vstinner, rhettinger, pitrou, jtaylor, serhiy.storchaka, alecsandru.patrascu, catalin.manciu |
2016-03-10 09:47:41 | vstinner | set | messageid: <1457603261.36.0.840222212626.issue26249@psf.upfronthosting.co.za> |
2016-03-10 09:47:41 | vstinner | link | issue26249 messages |
2016-03-10 09:47:41 | vstinner | create | |
|