micropython/tests/stress/recursive_gen.py
Jeff Epler cbf981f330 py/objgenerator: Check stack before resuming a generator.
This turns a hard crash in a recursive generator into a 'maximum recursion
depth exceeded' exception.
2018-04-10 14:06:26 +10:00

10 lines
137 B
Python

# test deeply recursive generators
def gen():
yield from gen()
try:
list(gen())
except RuntimeError:
print('RuntimeError')