aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 7d362af32cb..ee5d4981da5 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1956,31 +1956,30 @@ Py_FinalizeEx(void)
// XXX Ensure finalizer errors are handled properly.
finalize_interp_clear(tstate);
- finalize_interp_delete(tstate->interp);
-
-#ifdef Py_REF_DEBUG
- if (show_ref_count) {
- _PyDebug_PrintTotalRefs();
- }
- _Py_FinalizeRefTotal(runtime);
-#endif
- _Py_FinalizeAllocatedBlocks(runtime);
#ifdef Py_TRACE_REFS
/* Display addresses (& refcnts) of all objects still alive.
* An address can be used to find the repr of the object, printed
- * above by _Py_PrintReferences.
- */
-
+ * above by _Py_PrintReferences. */
if (dump_refs) {
_Py_PrintReferenceAddresses(tstate->interp, stderr);
}
-
if (dump_refs_fp != NULL) {
_Py_PrintReferenceAddresses(tstate->interp, dump_refs_fp);
fclose(dump_refs_fp);
}
#endif /* Py_TRACE_REFS */
+
+ finalize_interp_delete(tstate->interp);
+
+#ifdef Py_REF_DEBUG
+ if (show_ref_count) {
+ _PyDebug_PrintTotalRefs();
+ }
+ _Py_FinalizeRefTotal(runtime);
+#endif
+ _Py_FinalizeAllocatedBlocks(runtime);
+
#ifdef WITH_PYMALLOC
if (malloc_stats) {
_PyObject_DebugMallocStats(stderr);