summaryrefslogtreecommitdiffstats
path: root/Python/context.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-24 01:21:15 (GMT)
committerGitHub <noreply@github.com>2020-06-24 01:21:15 (GMT)
commitcde283d16d87024f455e45c6f1b4e4f7d8905836 (patch)
tree12b25c50ca8e357e8095f24689001a9512cf0ab6 /Python/context.c
parent2f9ada96e0d420fed0d09a032b37197f08ef167a (diff)
downloadcpython-cde283d16d87024f455e45c6f1b4e4f7d8905836.zip
cpython-cde283d16d87024f455e45c6f1b4e4f7d8905836.tar.gz
cpython-cde283d16d87024f455e45c6f1b4e4f7d8905836.tar.bz2
bpo-40521: Fix _PyContext_Fini() (GH-21103)
Only clear _token_missing in the main interpreter.
Diffstat (limited to 'Python/context.c')
-rw-r--r--Python/context.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/context.c b/Python/context.c
index dc34071..15d8b8e 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;