mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
#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
This commit is contained in:
parent
b93fff0a57
commit
dbf3b258e7
3 changed files with 42 additions and 1 deletions
|
@ -244,7 +244,6 @@ local_traverse(localobject *self, visitproc visit, void *arg)
|
|||
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 @@ local_dealloc(localobject *self)
|
|||
PyDict_DelItem(tstate->dict, self->key);
|
||||
}
|
||||
|
||||
Py_XDECREF(self->key);
|
||||
local_clear(self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue