Commit 5ae3ddcc authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/main: Check pending exception at the end of code block execution.

Usually this checking is done by VM on jump instructions, but for linear
sequences of instructions and builtin functions this won't happen. Particular
target of this change is long-running builtin functions like time.sleep().
parent 66b96822
...@@ -121,6 +121,12 @@ STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, ...@@ -121,6 +121,12 @@ STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind,
if (!compile_only) { if (!compile_only) {
// execute it // execute it
mp_call_function_0(module_fun); mp_call_function_0(module_fun);
// check for pending exception
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_hal_set_interrupt_char(-1); mp_hal_set_interrupt_char(-1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment