https://github.com/python/cpython/commit/6e67fd5beaa26cd80d43a258c14f6044803d33fa
commit: 6e67fd5beaa26cd80d43a258c14f6044803d33fa
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-06-04T10:02:12Z
summary:

[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 <[email protected]>

files:
M Python/pylifecycle.c

diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 67bbbd01ca0c48..cbdf5c1b771fff 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();

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to