STINNER Victor added the comment:

>> We have to be careful with the GIL: PyMem_*() functions can only be
>> called when holding the GIL.

> (...)
> I think there's a potential problem here :)

I didn't understand the motivation to require the GIL held for PyMem_Malloc(). 
I searched in the source code history and on the Internet (archives of 
python-dev). In my opinion, the restiction is motivated by a bug: 
PyMem_Malloc() calls (indirectly) PyObject_Malloc() in debug mode, and 
PyObject_Malloc() is not thread-safe.

I opened a thread on python-dev to discuss this point.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18203>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to