From 888ddb81ddfe9cd43991f8054967a0f0d5911cf1 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Fri, 24 Jan 2020 18:01:55 +1100 Subject: [PATCH] py/emitnative: Stop after finding an unwind target. The loop searches backwards for a target, but doesn't stop after finding the first result, meaning that it'll always end up at the outermost exception handler. --- py/emitnative.c | 1 + 1 file changed, 1 insertion(+) diff --git a/py/emitnative.c b/py/emitnative.c index 0affbeb0b..d0252560f 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -2774,6 +2774,7 @@ STATIC void emit_native_yield(emit_t *emit, int kind) { // Found active handler, get its PC ASM_MOV_REG_PCREL(emit->as, REG_RET, e->label); ASM_MOV_LOCAL_REG(emit->as, LOCAL_IDX_EXC_HANDLER_PC(emit), REG_RET); + break; } } }