mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #17807: Generators can now be finalized even when they are part of a reference cycle.
This commit is contained in:
parent
070cb3c9be
commit
04e70d19e7
8 changed files with 335 additions and 245 deletions
|
@ -524,10 +524,7 @@ untrack_dicts(PyGC_Head *head)
|
|||
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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue