]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merge rev 42607 from the trunk.
authorTim Peters <tim.peters@gmail.com>
Mon, 27 Feb 2006 17:47:02 +0000 (17:47 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 27 Feb 2006 17:47:02 +0000 (17:47 +0000)
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).

Misc/NEWS
Python/pystate.c

index 675c045b0b0bec27fb55649ce39b1b7bb5909a3c..9681782a661c10fa1452f68c0369a61b8cf7d713 100644 (file)
--- 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
 -----------------
 
index 52ff1511a05e39ccbb5eebbd24dbdbeeac151698..cdb7176696840f7c42064c1077ee12eb4b93d21c 100644 (file)
@@ -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 */
 }