[issue16610] Silent StopIteration exc when raised from generator inside of another generator

Stepan Wagner report at bugs.python.org
Tue Dec 4 20:46:00 CET 2012


New submission from Stepan Wagner:

def emptygen():
    # Or other more meaningful generator
    raise StopIteration
    yield

def wrap(gen):
    next(gen)
    print("This should be printed or StopIteration raised.")
    while True:
        try:
            yield next(gen)
        except StopIteration as exc:
            return

items = wrap(emptygen())
for item in items:
    print(item)

print("End.")

----------
components: Interpreter Core
messages: 176939
nosy: Stepan.Wagner
priority: normal
severity: normal
status: open
title: Silent StopIteration exc when raised from generator inside of another generator
type: behavior
versions: Python 2.6, Python 3.1

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


More information about the Python-bugs-list mailing list