Issue #17807: Generators can now be finalized even when they are part of a reference cycle.
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 4315d55..49251cd 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -524,10 +524,7 @@
static int
has_finalizer(PyObject *op)
{
- if (PyGen_CheckExact(op))
- return PyGen_NeedsFinalizing((PyGenObject *)op);
- else
- return op->ob_type->tp_del != NULL;
+ return op->ob_type->tp_del != NULL;
}
/* Move the objects in unreachable with __del__ methods into `finalizers`.