Xiang Zhang added the comment:

>>> I fixed Python 3, no?

Yes. In Python3 they are replaced by PyMem_RawMalloc. But it's not only 
PyMem_Malloc, there are also PyErr_SetString, PyErr_NoMemory, even in Python3.

BTW, even in Python3, when memory allocators are in debug mode, it finally 
calls bumpserialno, which IIUC, is not thread safe. But of course it's another 
issue.

>>> For Python 2, in practice you can call PyMem_Malloc() without holding the 
>>> GIL, it's just malloc() which is thread safe.

Hmm, I know it. But it's not stated in the doc they are thread safe, I am not 
sure assuming this is suitable. An example is 
https://github.com/psycopg/psycopg2/issues/110.

----------

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

Reply via email to