[issue21379] StopIteration is silenced when raised by generator within context manager

Nick Coghlan report at bugs.python.org
Tue Apr 29 08:34:32 CEST 2014


Nick Coghlan added the comment:

This is expected behaviour - "raise StopIteration" in a generator is equivalent to "return", except it can occur inside a called function.

The bug here is in the given context manager definition - it should be taking appropriate action if the "next" call failing is supposed to be treated as an error rather than termination of the generator.

----------
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21379>
_______________________________________


More information about the Python-bugs-list mailing list