diff options
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 49251cd..4315d55 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -524,7 +524,10 @@ untrack_dicts(PyGC_Head *head) static int has_finalizer(PyObject *op) { - return op->ob_type->tp_del != NULL; + if (PyGen_CheckExact(op)) + return PyGen_NeedsFinalizing((PyGenObject *)op); + else + return op->ob_type->tp_del != NULL; } /* Move the objects in unreachable with __del__ methods into `finalizers`. |