Commit f5f336a8 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-36356: pymain_free() calls _PyRuntime_Finalize() (GH-12435)

Ensure that _PyRuntime_Finalize() is always call. This change fix a
few memory leaks when running "python3 -V".
parent fecc4f2b
...@@ -184,6 +184,8 @@ PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(void); ...@@ -184,6 +184,8 @@ PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(void);
Return NULL on success, or return an error message on failure. */ Return NULL on success, or return an error message on failure. */
PyAPI_FUNC(_PyInitError) _PyRuntime_Initialize(void); PyAPI_FUNC(_PyInitError) _PyRuntime_Initialize(void);
PyAPI_FUNC(void) _PyRuntime_Finalize(void);
#define _Py_CURRENTLY_FINALIZING(tstate) \ #define _Py_CURRENTLY_FINALIZING(tstate) \
(_PyRuntime.finalizing == tstate) (_PyRuntime.finalizing == tstate)
......
...@@ -839,6 +839,7 @@ pymain_free(void) ...@@ -839,6 +839,7 @@ pymain_free(void)
_PyPathConfig_ClearGlobal(); _PyPathConfig_ClearGlobal();
_Py_ClearStandardStreamEncoding(); _Py_ClearStandardStreamEncoding();
_Py_ClearArgcArgv(); _Py_ClearArgcArgv();
_PyRuntime_Finalize();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment