mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
decref cached keys on type deallocation (#13903)
This commit is contained in:
parent
9e66ac683c
commit
64acccf46d
1 changed files with 5 additions and 3 deletions
|
|
@ -2593,6 +2593,9 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
|
||||||
return update_slot(type, name);
|
return update_slot(type, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_PyDictKeys_DecRef(PyDictKeysObject *keys);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
type_dealloc(PyTypeObject *type)
|
type_dealloc(PyTypeObject *type)
|
||||||
{
|
{
|
||||||
|
|
@ -2616,6 +2619,8 @@ type_dealloc(PyTypeObject *type)
|
||||||
Py_XDECREF(et->ht_name);
|
Py_XDECREF(et->ht_name);
|
||||||
Py_XDECREF(et->ht_qualname);
|
Py_XDECREF(et->ht_qualname);
|
||||||
Py_XDECREF(et->ht_slots);
|
Py_XDECREF(et->ht_slots);
|
||||||
|
if (et->ht_cached_keys)
|
||||||
|
_PyDictKeys_DecRef(et->ht_cached_keys);
|
||||||
Py_TYPE(type)->tp_free((PyObject *)type);
|
Py_TYPE(type)->tp_free((PyObject *)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2791,9 +2796,6 @@ type_traverse(PyTypeObject *type, visitproc visit, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void
|
|
||||||
_PyDictKeys_DecRef(PyDictKeysObject *keys);
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
type_clear(PyTypeObject *type)
|
type_clear(PyTypeObject *type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue