]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40521: Fix _PyContext_Fini() (GH-21103)
authorVictor Stinner <vstinner@python.org>
Wed, 24 Jun 2020 01:21:15 +0000 (03:21 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Jun 2020 01:21:15 +0000 (03:21 +0200)
Only clear _token_missing in the main interpreter.

Python/context.c

index dc340718847507e9287773559f8cd8ca39f591d4..15d8b8ea4b9b61046761e73746581e807c621e0f 100644 (file)
@@ -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;