diff Modules/threadmodule.c @ 56275:ee9a551a875e 2.6

Merged revisions 75123 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r75123 | philip.jenvey | 2009-09-28 21:32:44 -0700 (Mon, 28 Sep 2009) | 4 lines #6990: clear threading.local's key only after its thread state is removed: fixes local subclasses leaving old state around after a ref cycle GC which could be recycled by new locals ........
author Philip Jenvey <pjenvey@underboss.org>
date Tue, 29 Sep 2009 04:41:54 +0000
parents 8ccb35739a96
children c6f6be5317ad
line wrap: on
line diff
--- a/Modules/threadmodule.c	Mon Sep 28 19:53:25 2009 +0000
+++ b/Modules/threadmodule.c	Tue Sep 29 04:41:54 2009 +0000
@@ -227,7 +227,6 @@
 static int
 local_clear(localobject *self)
 {
-	Py_CLEAR(self->key);
 	Py_CLEAR(self->args);
 	Py_CLEAR(self->kw);
 	Py_CLEAR(self->dict);
@@ -249,6 +248,7 @@
 				PyDict_DelItem(tstate->dict, self->key);
 	}
 
+	Py_XDECREF(self->key);
 	local_clear(self);
 	Py_TYPE(self)->tp_free((PyObject*)self);
 }