STINNER Victor email@example.com added the comment:
Are you sure about PyMem_Malloc() and PyObject_Malloc()?
Technically, the pymalloc memory allocator is initialized statically by the compiler, from the first instruction of the process.
But maybe we should not suggest users to call them, especially because the allocator can be modified by the PYTHONMALLOC environment variable.
What functions require them?
No function to initalize Python require PyMem or PyObject allocators. Only PyMem_Raw allocator is needed.
Py_EncodeLocale() uses it, but this function also uses Python objects (str, bytes), and so Py_EncodeLocale() must no be called before Py_Initialize().
_______________________________________ Python tracker firstname.lastname@example.org https://bugs.python.org/issue32124 _______________________________________