circuitpython/tests/basics/try_finally_break2.py
Damien George 82c494a97e py/vm: Fix handling of unwind jump out of active finally.
Prior to this commit, when unwinding through an active finally the stack
was not being correctly popped/folded, which resulting in the VM crashing
for complicated unwinding of nested finallys.

This should be fixed with this commit, and more tests for return/break/
continue within a finally have been added to exercise this.
2019-10-04 23:01:29 +10:00

20 lines
530 B
Python

def foo(x):
for i in range(x):
for j in range(x):
try:
print(x, i, j, 1)
finally:
try:
try:
print(x, i, j, 2)
finally:
try:
1 / 0
finally:
print(x, i, j, 3)
break
finally:
print(x, i, j, 4)
break
print(foo(4))