summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;