summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/try_reraise.py
blob: bf5e77c0b03d043350e844a91870d322108eebf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Reraising last exception with raise w/o args

def f():
    try:
        raise ValueError("val", 3)
    except:
        raise

try:
    f()
except ValueError as e:
    print(repr(e))


# Can reraise only in except block
try:
    raise
except RuntimeError:
    print("RuntimeError")