circuitpython/tests/stress/recursive_gen.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
336 B
Python
Raw Normal View History

# test deeply recursive generators
# simple "yield from" recursion
def gen():
yield from gen()
try:
list(gen())
except RuntimeError:
print("RuntimeError")
# recursion via an iterator over a generator
def gen2():
for x in gen2():
yield x
try:
next(gen2())
except RuntimeError:
print("RuntimeError")