summaryrefslogtreecommitdiff
path: root/tests/micropython/native_try_deep.py
blob: 26b9243e03d41bc53327497e7d608f99e5cce931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# test native try handling


# deeply nested try (9 deep)
@micropython.native
def f():
    try:
        try:
            try:
                try:
                    try:
                        try:
                            try:
                                try:
                                    try:
                                        raise ValueError
                                    finally:
                                        print(8)
                                finally:
                                    print(7)
                            finally:
                                print(6)
                        finally:
                            print(5)
                    finally:
                        print(4)
                finally:
                    print(3)
            finally:
                print(2)
        finally:
            print(1)
    except ValueError:
        print("ValueError")


f()