Skip to content

Commit

Permalink
pybricks.tools.run_task: Fix not handling pending exceptions.
Browse files Browse the repository at this point in the history
This was causing the stop button not to work in async programs.

Fixes 261663e and a017bae
  • Loading branch information
laurensvalk committed Sep 5, 2024
1 parent d71a0db commit bd7c345
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pybricks/tools/pb_module_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ static mp_obj_t pb_module_tools_run_task(size_t n_args, const mp_obj_t *pos_args
run_loop_is_active = true;
mp_obj_t iterable = mp_getiter(task_in, &iter_buf);
while (mp_iternext(iterable) != MP_OBJ_STOP_ITERATION) {
// Keep running system processes.
MICROPY_VM_HOOK_LOOP
// Stop on exception such as SystemExit.
mp_handle_pending(true);
}
nlr_pop();
run_loop_is_active = false;
Expand Down

0 comments on commit bd7c345

Please sign in to comment.