8000 bpo-1635741: Explict GC collect after PyInterpreterState_Clear() (GH-… · python/cpython@8aa163e · GitHub
[go: up one dir, main page]

Skip to content

Commit 8aa163e

Browse files
authored
bpo-1635741: Explict GC collect after PyInterpreterState_Clear() (GH-21902)
Fix a reference cycle by triggering an explicit GC collection after calling PyInterpreterState_Clear().
1 parent 29f8429 commit 8aa163e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Python/pylifecycle.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,10 +1286,8 @@ finalize_interp_clear(PyThreadState *tstate)
12861286
/* Clear interpreter state and all thread states */
12871287
PyInterpreterState_Clear(tstate->interp);
12881288

1289-
/* Trigger a GC collection on subinterpreters*/
1290-
if (!is_main_interp) {
1291-
_PyGC_CollectNoFail();
1292-
}
1289+
/* Last explicit GC collection */
1290+
_PyGC_CollectNoFail();
12931291

12941292
/* Clear all loghooks */
12951293
/* Both _PySys_Audit function and users still need PyObject, such as tuple.

0 commit comments

Comments
 (0)
0