2018-08-16 00:43:35 -04:00
|
|
|
# test native try handling
|
|
|
|
|
2023-02-01 03:08:41 -05:00
|
|
|
|
2018-08-16 00:43:35 -04:00
|
|
|
# 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:
|
2021-04-20 01:22:44 -04:00
|
|
|
print("ValueError")
|
|
|
|
|
|
|
|
|
2018-08-16 00:43:35 -04:00
|
|
|
f()
|