Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7525] Yield example doesn't work as is explained in the documentation

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Dec 16, 2009, 7:09 AM

Post #1 of 2 (167 views)
Permalink
[issue7525] Yield example doesn't work as is explained in the documentation

New submission from xiscu <xiscu [at] email>:

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

----------
assignee: georg.brandl
components: Documentation
files: yield_example_1.py
messages: 96489
nosy: georg.brandl, xiscu
severity: normal
status: open
title: Yield example doesn't work as is explained in the documentation
type: resource usage
versions: Python 2.6
Added file: http://bugs.python.org/file15576/yield_example_1.py

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Dec 19, 2009, 10:32 AM

Post #2 of 2 (131 views)
Permalink
[issue7525] Yield example doesn't work as is explained in the documentation [In reply to]

Georg Brandl <georg [at] python> added the comment:

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.

----------
resolution: -> out of date
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.