summaryrefslogtreecommitdiff
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-27 17:15:31 +0000
committerTim Peters <tim.peters@gmail.com>2006-02-27 17:15:31 +0000
commite5a3388c646b7c22ad8754dc9c9d3bde8ebe1bb4 (patch)
treea2191d3661a86d7eeed076944b3dc43a2e8d0d64 /Python/pystate.c
parentd14d99b7c1c51cc76b81f71d8007ae5111d61171 (diff)
downloadcpython-e5a3388c646b7c22ad8754dc9c9d3bde8ebe1bb4.tar.gz
Patch 1413181, by Gabriel Becedillas.
PyThreadState_Delete(): if the auto-GIL-state machinery knows about the thread state, forget it (since the thread state is being deleted, continuing to remember it can't help, but can hurt if another thread happens to get created with the same thread id). I'll backport to 2.4 next.
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 6584cda775..867334e81e 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 */
}