summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/gen_yield_from_exc.py
blob: 01c954f5b7298da277a22c63082269ee08cb2de2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
def gen():
    yield 1
    yield 2
    raise ValueError

def gen2():
    try:
        print((yield from gen()))
    except ValueError:
        print("caught ValueError from downstream")

g = gen2()
print(list(g))