micropython/tests/basics/try2.py
Paul Sokolovsky 382e8eeea2 vm: Add basic implementation of END_FINALLY opcode.
Allows to have nested try blocks with except filters.

TODO: Don't add END_FINALLY's exception re-raise points to traceback.
2014-01-30 13:49:18 +02:00

24 lines
333 B
Python

# nested try's
try:
print("try 1")
try:
print("try 2")
foo()
except:
print("except 2")
bar()
except:
print("except 1")
try:
print("try 1")
try:
print("try 2")
foo()
except TypeError:
print("except 2")
bar()
except NameError:
print("except 1")