From aedaa405953f6fad29ecd5e16d10de126ecb1af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20de=20Giessen?= Date: Wed, 16 Apr 2025 14:17:14 +0200 Subject: [PATCH] py/modthread: Initialize thread state nlr_top to NULL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures the check in MP_NLR_JUMP_HEAD works as expected and nlr_jump_fail gets called so we get a bit better error message. Signed-off-by: Daniƫl van de Giessen --- py/runtime.h | 1 + 1 file changed, 1 insertion(+) diff --git a/py/runtime.h b/py/runtime.h index 77cdd0e20..ffbc3972a 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -165,6 +165,7 @@ static inline void mp_thread_init_state(mp_state_thread_t *ts, size_t stack_size ts->gc_lock_depth = 0; // There are no pending jump callbacks or exceptions yet + ts->nlr_top = NULL; ts->nlr_jump_callback_top = NULL; ts->mp_pending_exception = MP_OBJ_NULL;