[issue33015] Fix function cast warning in thread_pthread.h

STINNER Victor report at bugs.python.org
Fri Nov 30 17:53:05 EST 2018


STINNER Victor <vstinner at redhat.com> added the comment:

> why was that only an issue on 2.7?

I added PyMem_RawMalloc() to Python 3.4 and this function must be thread-safe.

https://docs.python.org/dev/c-api/memory.html#raw-memory-interface
"These functions are thread-safe, the GIL does not need to be held."

I replaced PyMem_RawMalloc() with PyMem_Malloc() when I backported the change, but I didn't know that PyMem_Malloc() isn't thread-safe *in debug mode*!

Gregory: do you think that it would be be crazy to fix PyMem_Malloc() to make it thread-safe in debug mode as well? I implemented a fix: PR 10828.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33015>
_______________________________________


More information about the Python-bugs-list mailing list