aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-06-04 12:02:12 +0200
committerGitHub <noreply@github.com>2024-06-04 10:02:12 +0000
commit6e67fd5beaa26cd80d43a258c14f6044803d33fa (patch)
tree848aa9ebf228cde7e4a3cc64c4038f616ee2e6b0
parent[3.13] gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214) (#119334) (diff)
downloadcpython-6e67fd5beaa26cd80d43a258c14f6044803d33fa.tar.gz
cpython-6e67fd5beaa26cd80d43a258c14f6044803d33fa.tar.bz2
cpython-6e67fd5beaa26cd80d43a258c14f6044803d33fa.zip
[3.13] gh-111499: Fix PYTHONMALLOCSTATS at Python exit (GH-120021) (#120022)
gh-111499: Fix PYTHONMALLOCSTATS at Python exit (GH-120021) Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before the interpreter is deleted. (cherry picked from commit 5a1205b641df133932ed4c65b9a4ff5724e89963) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Python/pylifecycle.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 67bbbd01ca..cbdf5c1b77 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();