diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-27 19:07:36 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-27 19:07:36 (GMT) |
commit | 64acccf46d6aea1e7d975dcb23e3567cf0b49d5d (patch) | |
tree | 85a9cef7e6f9bd650e8f5310fbaf2e67e819a6fe /Objects | |
parent | 9e66ac683cce9f6e4abda7d01836dab70eeefb49 (diff) | |
download | cpython-64acccf46d6aea1e7d975dcb23e3567cf0b49d5d.zip cpython-64acccf46d6aea1e7d975dcb23e3567cf0b49d5d.tar.gz cpython-64acccf46d6aea1e7d975dcb23e3567cf0b49d5d.tar.bz2 |
decref cached keys on type deallocation (#13903)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 58f55df..9babd57 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2593,6 +2593,9 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) return update_slot(type, name); } +extern void +_PyDictKeys_DecRef(PyDictKeysObject *keys); + static void type_dealloc(PyTypeObject *type) { @@ -2616,6 +2619,8 @@ type_dealloc(PyTypeObject *type) Py_XDECREF(et->ht_name); Py_XDECREF(et->ht_qualname); Py_XDECREF(et->ht_slots); + if (et->ht_cached_keys) + _PyDictKeys_DecRef(et->ht_cached_keys); Py_TYPE(type)->tp_free((PyObject *)type); } @@ -2791,9 +2796,6 @@ type_traverse(PyTypeObject *type, visitproc visit, void *arg) return 0; } -extern void -_PyDictKeys_DecRef(PyDictKeysObject *keys); - static int type_clear(PyTypeObject *type) { |