]> granicus.if.org Git - python/commit
bpo-32030: Add _PyImport_Fini2() (#4737)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 6 Dec 2017 17:12:59 +0000 (18:12 +0100)
committerGitHub <noreply@github.com>
Wed, 6 Dec 2017 17:12:59 +0000 (18:12 +0100)
commit92a3c6f493ad411e4cf0acdf305ef4876aa90669
tree67cae429f766b6f99a69a303cf3960dd7893859f
parent1b4587a2462fc05a14be87123083322103a1f55b
bpo-32030: Add _PyImport_Fini2() (#4737)

PyImport_ExtendInittab() now uses PyMem_RawRealloc() rather than
PyMem_Realloc(). PyImport_ExtendInittab() can be called before
Py_Initialize() whereas only the PyMem_Raw allocator is supposed to
be used before Py_Initialize().

Add _PyImport_Fini2() to release the memory allocated by
PyImport_ExtendInittab() at exit. PyImport_ExtendInittab() now forces
the usage of the default raw allocator, to be able to release memory
in _PyImport_Fini2().

Don't export these functions anymore to be C API, only to
Py_BUILD_CORE:

* _PyExc_Fini()
* _PyImport_Fini()
* _PyGC_DumpShutdownStats()
* _PyGC_Fini()
* _PyType_Fini()
* _Py_HashRandomization_Fini()
Include/pylifecycle.h
Modules/main.c
Python/import.c