Skip to content

Commit 93bb7df

Browse files
committed
py/vm: Fix popping of exception block in UNWIND_JUMP opcode.
Fixes issue adafruit#1812.
1 parent 9e67711 commit 93bb7df

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

py/vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ unwind_jump:;
674674
exc_sp--; // pop exception handler
675675
goto dispatch_loop; // run the exception handler
676676
}
677-
exc_sp--;
677+
POP_EXC_BLOCK();
678678
}
679679
ip = (const byte*)MP_OBJ_TO_PTR(POP()); // pop destination ip for jump
680680
if (unum != 0) {

tests/basics/try_continue.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# test continue within exception handler
2+
3+
def f():
4+
lst = [1, 2, 3]
5+
for x in lst:
6+
print('a', x)
7+
try:
8+
if x == 2:
9+
raise Exception
10+
except Exception:
11+
continue
12+
print('b', x)
13+
f()

0 commit comments

Comments
 (0)