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 <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-08-02 15:24:45 -05:00 committed by Damien George
parent 658a2e3dbd
commit c0252d73c6

View file

@ -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; nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
mp_obj_t tmp = mp_binary_op(op, lhs, rhs); mp_obj_t tmp = mp_binary_op(op, lhs, rhs);
nlr_pop();
#if MICROPY_PY_BUILTINS_COMPLEX #if MICROPY_PY_BUILTINS_COMPLEX
if (mp_obj_is_type(tmp, &mp_type_complex)) { if (mp_obj_is_type(tmp, &mp_type_complex)) {
return false; return false;
} }
#endif #endif
*res = tmp; *res = tmp;
nlr_pop();
return true; return true;
} else { } else {
return false; return false;