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.

classification
Title: Yield example doesn't work as is explained in the documentation
Type: resource usage Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, xiscu
Priority: normal Keywords:

Created on 2009-12-16 15:09 by xiscu, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
yield_example_1.py xiscu, 2009-12-16 15:09 Yield example
Messages (2)
msg96489 - (view) Author: xiscu (xiscu) Date: 2009-12-16 15:09
In the documentation the is:

...
>>>generator.throw(TypeError, "spam")
TypeError('spam',)
>>> generator.close()
Don't forget to clean up when 'close()' is called.
...

I'm getting:
>>>generator.throw(TypeError, "spam")
TypeError('spam',)
>>> generator.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: generator ignored GeneratorExit
...

My proposal here is yield_example_1.py

Thanks
msg96639 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-12-19 18:32
This only happens in Python 2.5, where GeneratorExit inherits from
Exception.  In 2.6, it inherits from BaseException and is therefore not
caught by the except clause.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51774
2009-12-19 18:32:15georg.brandlsetstatus: open -> closed
resolution: out of date
messages: + msg96639
2009-12-16 15:09:22xiscucreate