py/emitnative: Fix try-finally in outer scope, so finally is cancelled.

pull/4118/head
Damien George 2018-09-11 15:33:25 +10:00
rodzic 67ee4e2401
commit f2de9d60f7
2 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -914,7 +914,7 @@ STATIC void emit_native_label_assign(emit_t *emit, mp_uint_t l) {
if (is_finally) {
// Label is at start of finally handler: pop exception stack
emit_native_leave_exc_stack(emit, true);
emit_native_leave_exc_stack(emit, false);
}
}

Wyświetl plik

@ -82,3 +82,15 @@ finally:
print("except2")
print("finally1")
print()
# case where exception is raised after a finally has finished (tests that the finally doesn't run again)
def func():
try:
print("try")
finally:
print("finally")
foo
try:
func()
except:
print("except")