mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Backout c89febab4648 following private feedback by Guido.
(Issue #17807: Generators can now be finalized even when they are part of a reference cycle)
This commit is contained in:
parent
b710d7e4c3
commit
9396356948
8 changed files with 245 additions and 335 deletions
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue