[Python-checkins] bpo-40521: Fix _PyContext_Fini() (GH-21103)

Victor Stinner webhook-mailer at python.org
Tue Jun 23 21:21:23 EDT 2020


https://github.com/python/cpython/commit/cde283d16d87024f455e45c6f1b4e4f7d8905836
commit: cde283d16d87024f455e45c6f1b4e4f7d8905836
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-06-24T03:21:15+02:00
summary:

bpo-40521: Fix _PyContext_Fini() (GH-21103)

Only clear _token_missing in the main interpreter.

files:
M Python/context.c

diff --git a/Python/context.c b/Python/context.c
index dc34071884750..15d8b8ea4b9b6 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -1302,7 +1302,9 @@ _PyContext_ClearFreeList(PyThreadState *tstate)
 void
 _PyContext_Fini(PyThreadState *tstate)
 {
-    Py_CLEAR(_token_missing);
+    if (_Py_IsMainInterpreter(tstate)) {
+        Py_CLEAR(_token_missing);
+    }
     _PyContext_ClearFreeList(tstate);
 #ifdef Py_DEBUG
     struct _Py_context_state *state = &tstate->interp->context;



More information about the Python-checkins mailing list