From c0252d73c6499cf8c09fa57e17f4b530315b0ee0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 2 Aug 2025 15:24:45 -0500 Subject: [PATCH] py/parse: Fix missing nlr_pop call in complex path of binary_op_maybe. Reproducer (needs to be run as one compilation unit): ans = (-1) ** 2.3 aa Fixes issue #17815. Signed-off-by: Jeff Epler --- py/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/parse.c b/py/parse.c index 91eea3e36..6260987b2 100644 --- a/py/parse.c +++ b/py/parse.c @@ -671,13 +671,13 @@ static bool binary_op_maybe(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs, mp_ob nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_obj_t tmp = mp_binary_op(op, lhs, rhs); + nlr_pop(); #if MICROPY_PY_BUILTINS_COMPLEX if (mp_obj_is_type(tmp, &mp_type_complex)) { return false; } #endif *res = tmp; - nlr_pop(); return true; } else { return false;