summaryrefslogtreecommitdiff
path: root/tests/stress/recursive_gen.py
blob: 8c2139765847d44f3201832922050abd92344d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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")