diff --git a/Objects/object.c b/Objects/object.c index 27f89e8d752..6bb10eb1326 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1996,8 +1996,21 @@ _PyTypes_FiniTypes(PyInterpreterState *interp) PyTypeObject *type = static_types[i]; // Cannot delete a type if it still has subclasses if (type->tp_subclasses != NULL) { + fprintf(stderr, "Cannot clear type '%s': it still has subclasses\n", type->tp_name); + //_PyObject_Dump(type->tp_subclasses); + { + Py_ssize_t i = 0; + PyObject *ref; + while (PyDict_Next(type->tp_subclasses, &i, NULL, &ref)) { + PyObject *obj = PyWeakref_GET_OBJECT(ref); + PyTypeObject *subclass = _PyType_CAST(obj); + fprintf(stderr, "* %s\n", subclass->tp_name); + } + + } continue; } + //fprintf(stderr, "Deallocate type '%s'\n", type->tp_name); _PyStaticType_Dealloc(type); } }