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 <damien@micropython.org>
This commit is contained in:
Damien George 2021-04-28 10:50:09 +10:00
parent a41cd150be
commit 7e549b6718
1 changed files with 1 additions and 3 deletions

View File

@ -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;
}