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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to