STINNER Victor added the comment: You must hold the GIL to call PyMem_Malloc(). A debug assert should be raised if you don't hold the GIL since Python 3.6 with PYTHONMALLOC=debug.
Call PyMem_RawMalloc(). I fixed Python 3, no? For Python 2, in practice you can call PyMem_Malloc() without holding the GIL, it's just malloc() which is thread safe. ---------- _______________________________________ 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