summaryrefslogtreecommitdiffstats
path: root/Modules/gcmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r--Modules/gcmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 0badc23..a0522a0 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -241,7 +241,9 @@ move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
for (; gc != unreachable; gc=next) {
PyObject *op = FROM_GC(gc);
next = gc->gc.gc_next;
- if (PyInstance_Check(op) && PyObject_HasAttr(op, delstr)) {
+ if ((PyInstance_Check(op) ||
+ PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) &&
+ PyObject_HasAttr(op, delstr)) {
gc_list_remove(gc);
gc_list_append(gc, finalizers);
}