[Python-checkins] cpython: decref cached keys on type deallocation (#13903)

benjamin.peterson python-checkins at python.org
Fri Apr 27 21:07:41 CEST 2012


http://hg.python.org/cpython/rev/a3beae842f13
changeset:   76581:a3beae842f13
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Apr 27 15:07:36 2012 -0400
summary:
  decref cached keys on type deallocation (#13903)

files:
  Objects/typeobject.c |  8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2593,6 +2593,9 @@
     return update_slot(type, name);
 }
 
+extern void
+_PyDictKeys_DecRef(PyDictKeysObject *keys);
+
 static void
 type_dealloc(PyTypeObject *type)
 {
@@ -2616,6 +2619,8 @@
     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 @@
     return 0;
 }
 
-extern void
-_PyDictKeys_DecRef(PyDictKeysObject *keys);
-
 static int
 type_clear(PyTypeObject *type)
 {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list