diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-08-18 04:36:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 22:36:19 +0200 |
commit | 8aa163eea6b0fb4693f6c0a314d4f2ccada51d70 (patch) | |
tree | 0ad0e0b954fa815da8fecb1be32e34e8daf939fd /Python/pylifecycle.c | |
parent | bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method no... (diff) | |
download | cpython-8aa163eea6b0fb4693f6c0a314d4f2ccada51d70.tar.gz cpython-8aa163eea6b0fb4693f6c0a314d4f2ccada51d70.tar.bz2 cpython-8aa163eea6b0fb4693f6c0a314d4f2ccada51d70.zip |
bpo-1635741: Explict GC collect after PyInterpreterState_Clear() (GH-21902)
Fix a reference cycle by triggering an explicit GC collection
after calling PyInterpreterState_Clear().
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 2d219a4a3a8..ab5a6767864 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1286,10 +1286,8 @@ finalize_interp_clear(PyThreadState *tstate) /* Clear interpreter state and all thread states */ PyInterpreterState_Clear(tstate->interp); - /* Trigger a GC collection on subinterpreters*/ - if (!is_main_interp) { - _PyGC_CollectNoFail(); - } + /* Last explicit GC collection */ + _PyGC_CollectNoFail(); /* Clear all loghooks */ /* Both _PySys_Audit function and users still need PyObject, such as tuple. |