diff -r 38df99776901 Objects/typeobject.c --- a/Objects/typeobject.c Tue Apr 24 21:09:17 2012 +0200 +++ b/Objects/typeobject.c Fri Apr 27 18:00:12 2012 +0100 @@ -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); } @@ -2790,9 +2795,6 @@ return 0; } - -extern void -_PyDictKeys_DecRef(PyDictKeysObject *keys); static int type_clear(PyTypeObject *type)