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 <rep...@bugs.python.org> <http://bugs.python.org/issue21379> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com