Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "Delay subinterpreter finalization to after tracemalloc"
This reverts commit 029241e.
  • Loading branch information
emmatyping committed May 25, 2025
commit 911318ec868d8f6c198f724e6ca6975cbaefb83c
8 changes: 3 additions & 5 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,9 @@ _Py_Finalize(_PyRuntimeState *runtime)
_PyImport_FiniExternal(tstate->interp);
finalize_modules(tstate);

/* Clean up any lingering subinterpreters. */
finalize_subinterpreters();

/* Print debug stats if any */
_PyEval_Fini();

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

/* Clean up any lingering subinterpreters. It is important this happens
AFTER tracemalloc finalizes, as tracemalloc may hold references to
frame data in other interpreters. */
finalize_subinterpreters();

/* Finalize any remaining import state */
// XXX Move these up to where finalize_modules() is currently.
_PyImport_FiniCore(tstate->interp);
Expand Down