From 7e549b6718e80136b03074765f1d4add209a21a5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 28 Apr 2021 10:50:09 +1000 Subject: [PATCH] py/profile: Use mp_handle_pending() to raise pending exception. If MICROPY_ENABLE_SCHEDULER is enabled then MP_STATE_VM(sched_state) must be updated after handling the pending exception, which is done by the mp_handle_pending() function. Signed-off-by: Damien George --- py/profile.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/py/profile.c b/py/profile.c index 9cf8c4b7ba..e5fb35f0ed 100644 --- a/py/profile.c +++ b/py/profile.c @@ -298,9 +298,7 @@ STATIC mp_obj_t mp_prof_callback_invoke(mp_obj_t callback, prof_callback_args_t mp_prof_is_executing = false; if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) { - mp_obj_t obj = MP_STATE_VM(mp_pending_exception); - MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; - nlr_raise(obj); + mp_handle_pending(true); } return top; }