summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-05-14 18:37:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-05-14 18:37:52 (GMT)
commit93963569487bd3d13962c92d64a128e27330cf02 (patch)
tree6966ad6d6148e5ede6183a80a62890470f10d612 /Modules
parentb710d7e4c320fb299cf1ab2ec12e3821dc338bc8 (diff)
downloadcpython-93963569487bd3d13962c92d64a128e27330cf02.zip
cpython-93963569487bd3d13962c92d64a128e27330cf02.tar.gz
cpython-93963569487bd3d13962c92d64a128e27330cf02.tar.bz2
Backout c89febab4648 following private feedback by Guido.
(Issue #17807: Generators can now be finalized even when they are part of a reference cycle)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/gcmodule.c5
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`.