Antoine Pitrou added the comment: > We *don't care* if the generator *would* have caught the thrown > GeneratorExit, we only care about ensuring that finally blocks are > executed (including those implied by with statements). So if there > aren't any finally clauses or with statements in the block stack, we > should be able to just let the generator and frame get collected (as > Anssi suggested), without trying to allow execution to complete.
That's a good point. I'm also contemplating that the generator close() could be done from the *frame*'s tp_clear, which would sidestep the issue of collect order entirely: the finally block doesn't actually need the generator to execute, it only needs the frame and its locals. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17468> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com