diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-05-14 18:37:52 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-05-14 18:37:52 (GMT) |
commit | 93963569487bd3d13962c92d64a128e27330cf02 (patch) | |
tree | 6966ad6d6148e5ede6183a80a62890470f10d612 /Modules/gcmodule.c | |
parent | b710d7e4c320fb299cf1ab2ec12e3821dc338bc8 (diff) | |
download | cpython-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/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`. |