summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-12-04 11:51:03 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-12-04 11:51:03 (GMT)
commitac0e1c2694bc199dbd073312145e3c09bee52cc4 (patch)
treea61d2340569b90fa9d61e2270fc624865844687c
parentb96c6b0723b889d3a0c1740bce7f579f33d246f2 (diff)
downloadcpython-ac0e1c2694bc199dbd073312145e3c09bee52cc4.zip
cpython-ac0e1c2694bc199dbd073312145e3c09bee52cc4.tar.gz
cpython-ac0e1c2694bc199dbd073312145e3c09bee52cc4.tar.bz2
bpo-38962: Fix reference leak in the per-subinterpreter gc (GH-17457)
https://bugs.python.org/issue38962 Automerge-Triggered-By: @pablogsal
-rw-r--r--Python/pylifecycle.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 9218978..d6f65ec 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1253,17 +1253,16 @@ finalize_interp_clear(PyThreadState *tstate)
{
int is_main_interp = _Py_IsMainInterpreter(tstate);
- /* bpo-36854: Explicitly clear the codec registry
- and trigger a GC collection */
PyInterpreterState *interp = tstate->interp;
- Py_CLEAR(interp->codec_search_path);
- Py_CLEAR(interp->codec_search_cache);
- Py_CLEAR(interp->codec_error_registry);
- _PyGC_CollectNoFail();
/* Clear interpreter state and all thread states */
PyInterpreterState_Clear(tstate->interp);
+ /* Trigger a GC collection on subinterpreters*/
+ if (!is_main_interp) {
+ _PyGC_CollectNoFail();
+ }
+
finalize_interp_types(tstate, is_main_interp);
if (is_main_interp) {