Skip to content

Commit 911318e

Browse files
committed
Revert "Delay subinterpreter finalization to after tracemalloc"
This reverts commit 029241e.
1 parent d69d5c0 commit 911318e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

Python/pylifecycle.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,9 @@ _Py_Finalize(_PyRuntimeState *runtime)
21242124
_PyImport_FiniExternal(tstate->interp);
21252125
finalize_modules(tstate);
21262126

2127+
/* Clean up any lingering subinterpreters. */
2128+
finalize_subinterpreters();
2129+
21272130
/* Print debug stats if any */
21282131
_PyEval_Fini();
21292132

@@ -2155,11 +2158,6 @@ _Py_Finalize(_PyRuntimeState *runtime)
21552158
so it is possible to use tracemalloc in objects destructor. */
21562159
_PyTraceMalloc_Fini();
21572160

2158-
/* Clean up any lingering subinterpreters. It is important this happens
2159-
AFTER tracemalloc finalizes, as tracemalloc may hold references to
2160-
frame data in other interpreters. */
2161-
finalize_subinterpreters();
2162-
21632161
/* Finalize any remaining import state */
21642162
// XXX Move these up to where finalize_modules() is currently.
21652163
_PyImport_FiniCore(tstate->interp);

0 commit comments

Comments
 (0)