diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-02 00:38:06 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-04 19:16:56 +0200 |
commit | 5ae3ddcc9a8fab9c845d98d58b26b6d258809475 (patch) | |
tree | 61626265a0d73d304683432e00f50899ace768ca | |
parent | 66b96822fb33863fde5ce13a6bdeb99a404575dc (diff) | |
download | micropython-5ae3ddcc9a8fab9c845d98d58b26b6d258809475.tar.gz micropython-5ae3ddcc9a8fab9c845d98d58b26b6d258809475.zip |
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().
-rw-r--r-- | unix/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unix/main.c b/unix/main.c index e22176e13a..10de233a33 100644 --- a/unix/main.c +++ b/unix/main.c @@ -121,6 +121,12 @@ STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, if (!compile_only) { // execute it 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); |