summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-27 17:47:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-02-27 17:47:02 (GMT)
commit91e742fb6bb59c5a787f4b8a2584fdab4d82dd73 (patch)
tree310d622d09fd0cb9baa2646fe5ec43c8a4ac028b
parent05b92543cdec96583d8bd7b1ff867fcdee3ecebf (diff)
downloadcpython-91e742fb6bb59c5a787f4b8a2584fdab4d82dd73.zip
cpython-91e742fb6bb59c5a787f4b8a2584fdab4d82dd73.tar.gz
cpython-91e742fb6bb59c5a787f4b8a2584fdab4d82dd73.tar.bz2
Merge rev 42607 from the trunk.
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).
-rw-r--r--Misc/NEWS6
-rw-r--r--Python/pystate.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 675c045..9681782 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -44,6 +44,12 @@ Core and builtins
- Fix segfault with invalid coding.
+- Patch #1413181: changed ``PyThreadState_Delete()`` to forget about the
+ current thread state when the auto-GIL-state machinery knows about
+ 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).
+
Extension Modules
-----------------
diff --git a/Python/pystate.c b/Python/pystate.c
index 52ff151..cdb7176 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 */
}