diff options
author | Victor Stinner <vstinner@python.org> | 2024-06-04 09:39:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 09:39:07 (GMT) |
commit | 5a1205b641df133932ed4c65b9a4ff5724e89963 (patch) | |
tree | 68ade81471201e621529da66a5b8e8618510f291 /Python/pylifecycle.c | |
parent | 26e5c6e8351adb1a77a88920ff33fc8ebee9a99e (diff) | |
download | cpython-5a1205b641df133932ed4c65b9a4ff5724e89963.zip cpython-5a1205b641df133932ed4c65b9a4ff5724e89963.tar.gz cpython-5a1205b641df133932ed4c65b9a4ff5724e89963.tar.bz2 |
gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)
Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before
the interpreter is deleted.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 67bbbd0..cbdf5c1 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2119,6 +2119,12 @@ Py_FinalizeEx(void) } #endif /* Py_TRACE_REFS */ +#ifdef WITH_PYMALLOC + if (malloc_stats) { + _PyObject_DebugMallocStats(stderr); + } +#endif + finalize_interp_delete(tstate->interp); #ifdef Py_REF_DEBUG @@ -2129,12 +2135,6 @@ Py_FinalizeEx(void) #endif _Py_FinalizeAllocatedBlocks(runtime); -#ifdef WITH_PYMALLOC - if (malloc_stats) { - _PyObject_DebugMallocStats(stderr); - } -#endif - call_ll_exitfuncs(runtime); _PyRuntime_Finalize(); |