This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nikratio
Recipients docs@python, nikratio
Date 2011-08-06.18:12:25
SpamBayes Score 2.3616038e-05
Marked as misclassified No
Message-id <1312654346.88.0.619161172388.issue12704@psf.upfronthosting.co.za>
In-reply-to
Content
From http://docs.python.org/reference/simple_stmts.html#the-yield-statement:

"As of Python version 2.5, the yield statement is now allowed in the try clause of a try ... finally construct. If the generator is not resumed before it is finalized (by reaching a zero reference count or by being garbage collected), the generator-iterator’s close() method will be called, allowing any pending finally clauses to execute."

This strongly suggests that the last-executed yield statement will raise an exception if the generator is closed. If this is the case, it would be great if the documentation could be extended to say what exception is raised.

If this is not the case, it would be great if whatever magic is happening could be documented as well.
History
Date User Action Args
2011-08-06 18:12:27nikratiosetrecipients: + nikratio, docs@python
2011-08-06 18:12:26nikratiosetmessageid: <1312654346.88.0.619161172388.issue12704@psf.upfronthosting.co.za>
2011-08-06 18:12:26nikratiolinkissue12704 messages
2011-08-06 18:12:25nikratiocreate