summaryrefslogtreecommitdiff
path: root/tests/micropython/native_try_deep.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython/native_try_deep.py')
-rw-r--r--tests/micropython/native_try_deep.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py
new file mode 100644
index 000000000..7fac4f0f3
--- /dev/null
+++ b/tests/micropython/native_try_deep.py
@@ -0,0 +1,34 @@
+# 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()