[New-bugs-announce] [issue17807] Generator cleanup without tp_del

Antoine Pitrou report at bugs.python.org
Sun Apr 21 03:37:31 CEST 2013


New submission from Antoine Pitrou:

This experimental patch proposes to defer generator cleanup to the frame itself. In this scheme, the generator frame's tp_clear throws the GeneratorExit if necessary, so as to call cleanup code. The generator doesn't have any tp_del anymore, as it is now impossible to resurrect a generator (the frame, though, can be resurrected; I have to add a test for that).

The net effect is that generators caught in a reference cycle can always be reclaimed, and their cleanup code is run in a valid frame.

----------
components: Interpreter Core
files: gen2.patch
keywords: patch
messages: 187482
nosy: benjamin.peterson, ncoghlan, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Generator cleanup without tp_del
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29959/gen2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17807>
_______________________________________


More information about the New-bugs-announce mailing list