aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-06 18:12:59 +0100
committerGitHub <noreply@github.com>2017-12-06 18:12:59 +0100
commit92a3c6f493ad411e4cf0acdf305ef4876aa90669 (patch)
tree67cae429f766b6f99a69a303cf3960dd7893859f /Include/pylifecycle.h
parentbpo-25910: Fixes redirection from http to https (#4674) (diff)
downloadcpython-92a3c6f493ad411e4cf0acdf305ef4876aa90669.tar.gz
cpython-92a3c6f493ad411e4cf0acdf305ef4876aa90669.tar.bz2
cpython-92a3c6f493ad411e4cf0acdf305ef4876aa90669.zip
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()
Diffstat (limited to 'Include/pylifecycle.h')
-rw-r--r--Include/pylifecycle.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
index 4c87428a23a..bda51f84c3c 100644
--- a/Include/pylifecycle.h
+++ b/Include/pylifecycle.h
@@ -137,9 +137,18 @@ PyAPI_FUNC(_PyInitError) _Py_HashRandomization_Init(_PyCoreConfig *core_config);
#endif
/* Various internal finalizers */
-#ifndef Py_LIMITED_API
+
+#ifdef Py_BUILD_CORE
PyAPI_FUNC(void) _PyExc_Fini(void);
PyAPI_FUNC(void) _PyImport_Fini(void);
+PyAPI_FUNC(void) _PyImport_Fini2(void);
+PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
+PyAPI_FUNC(void) _PyGC_Fini(void);
+PyAPI_FUNC(void) _PyType_Fini(void);
+PyAPI_FUNC(void) _Py_HashRandomization_Fini(void);
+#endif /* Py_BUILD_CORE */
+
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyMethod_Fini(void);
PyAPI_FUNC(void) PyFrame_Fini(void);
PyAPI_FUNC(void) PyCFunction_Fini(void);
@@ -151,15 +160,11 @@ PyAPI_FUNC(void) PyBytes_Fini(void);
PyAPI_FUNC(void) PyByteArray_Fini(void);
PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
-PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
-PyAPI_FUNC(void) _PyGC_Fini(void);
PyAPI_FUNC(void) PySlice_Fini(void);
-PyAPI_FUNC(void) _PyType_Fini(void);
-PyAPI_FUNC(void) _Py_HashRandomization_Fini(void);
PyAPI_FUNC(void) PyAsyncGen_Fini(void);
PyAPI_FUNC(int) _Py_IsFinalizing(void);
-#endif
+#endif /* !Py_LIMITED_API */
/* Signals */
typedef void (*PyOS_sighandler_t)(int);