Skip to content

Commit 3245947

Browse files
committed
Finalize imports before tracemalloc
Signed-off-by: Rostan Tabet <[email protected]>
1 parent a65f802 commit 3245947

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python/pylifecycle.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,15 +2127,15 @@ _Py_Finalize(_PyRuntimeState *runtime)
21272127
_PyGC_CollectIfEnabled();
21282128
#endif
21292129

2130-
/* Disable tracemalloc after all Python objects have been destroyed,
2131-
so it is possible to use tracemalloc in objects destructor. */
2132-
_PyTraceMalloc_Fini();
2133-
21342130
/* Finalize any remaining import state */
21352131
// XXX Move these up to where finalize_modules() is currently.
21362132
_PyImport_FiniCore(tstate->interp);
21372133
_PyImport_Fini();
21382134

2135+
/* Disable tracemalloc after all Python objects have been destroyed,
2136+
so it is possible to use tracemalloc in objects destructor. */
2137+
_PyTraceMalloc_Fini();
2138+
21392139
/* unload faulthandler module */
21402140
_PyFaulthandler_Fini();
21412141

0 commit comments

Comments
 (0)