Mercurial > cpython-lru_cache-weakref
diff Modules/threadmodule.c @ 56274:eebf3d51d3a4 legacy-trunk
#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:32:44 +0000 |
| parents | e21c4c527e66 |
| children | 29fe5e7bd6ee |
line wrap: on
line diff
--- a/Modules/threadmodule.c Mon Sep 28 18:54:55 2009 +0000 +++ b/Modules/threadmodule.c Tue Sep 29 04:32:44 2009 +0000 @@ -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); }
