nrf/boards/microbit: Use mp_sched_exception() where appropriate.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-04-28 10:53:54 +10:00
parent 7cbf826a95
commit bd54eb566f
1 changed files with 2 additions and 2 deletions

View File

@ -305,7 +305,7 @@ static void draw_object(mp_obj_t obj) {
async_stop();
}
} else {
MP_STATE_VM(mp_pending_exception) = mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an image."));
mp_sched_exception(mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an image.")));
async_stop();
}
}
@ -341,7 +341,7 @@ static void microbit_display_update(void) {
if (mp_obj_get_type(nlr.ret_val) == &mp_type_MemoryError) {
mp_printf(&mp_plat_print, "Allocation in interrupt handler");
}
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(nlr.ret_val);
mp_sched_exception(MP_OBJ_FROM_PTR(nlr.ret_val));
}
obj = MP_OBJ_STOP_ITERATION;
}