summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 6584cda..867334e 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -262,6 +262,10 @@ PyThreadState_Delete(PyThreadState *tstate)
if (tstate == _PyThreadState_Current)
Py_FatalError("PyThreadState_Delete: tstate is still current");
tstate_delete_common(tstate);
+#ifdef WITH_THREAD
+ if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate)
+ PyThread_delete_key_value(autoTLSkey);
+#endif /* WITH_THREAD */
}