[issue6990] threading.local subclasses don't cleanup their state and it gets recycled

Philip Jenvey report at bugs.python.org
Fri Sep 25 19:23:42 CEST 2009


Philip Jenvey <pjenvey at users.sourceforge.net> added the comment:

Great, though I think it still needs to deallocated:

Index: Modules/threadmodule.c
===================================================================
--- Modules/threadmodule.c	(revision 75050)
+++ Modules/threadmodule.c	(working copy)
@@ -244,7 +244,6 @@
 static int
 local_clear(localobject *self)
 {
-	Py_CLEAR(self->key);
 	Py_CLEAR(self->args);
 	Py_CLEAR(self->kw);
 	Py_CLEAR(self->dict);
@@ -266,6 +265,7 @@
 				PyDict_DelItem(tstate->dict, self->key);
 	}
 
+	Py_XDECREF(self->key);
 	local_clear(self);
 	Py_TYPE(self)->tp_free((PyObject*)self);
 }

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6990>
_______________________________________


More information about the Python-bugs-list mailing list