diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-22 19:13:28 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-22 19:14:20 +0100 |
commit | 3be6984b8f435d108a04102d21346bf498b32f67 (patch) | |
tree | c8b6ce86cbdfccbb1d9cd88ed6b0c1e2dbcfce6c | |
parent | 8d62bbd46aa178abc6e029b0ba79d915f7f988c2 (diff) | |
download | micropython-3be6984b8f435d108a04102d21346bf498b32f67.tar.gz micropython-3be6984b8f435d108a04102d21346bf498b32f67.zip |
stmhal: Don't return SystemExit value from parse_compile_execute.
There is no need, since we don't (currently) use the value.
-rw-r--r-- | stmhal/pyexec.c | 19 | ||||
-rw-r--r-- | stmhal/pyexec.h | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c index c6b9b8b054..08a5866a04 100644 --- a/stmhal/pyexec.c +++ b/stmhal/pyexec.c @@ -91,18 +91,13 @@ int parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, boo // FIXME it could be that an interrupt happens just before we disable it here usb_vcp_set_interrupt_char(VCP_CHAR_NONE); // disable interrupt // check for SystemExit - mp_obj_t exc = (mp_obj_t)nlr.ret_val; - if (mp_obj_is_subclass_fast(mp_obj_get_type(exc), &mp_type_SystemExit)) { - // None is an exit value of 0; an int is its value; anything else is 1 - mp_obj_t exit_val = mp_obj_exception_get_value(exc); - mp_int_t val = 0; - if (exit_val != mp_const_none && !mp_obj_get_int_maybe(exit_val, &val)) { - val = 1; - } - return PYEXEC_FORCED_EXIT | (val & 255); + if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) { + // at the moment, the value of SystemExit is unused + ret = PYEXEC_FORCED_EXIT; + } else { + mp_obj_print_exception((mp_obj_t)nlr.ret_val); + ret = 0; } - mp_obj_print_exception((mp_obj_t)nlr.ret_val); - ret = 0; } // display debugging info if wanted @@ -269,7 +264,7 @@ friendly_repl_reset: } } -bool pyexec_file(const char *filename) { +int pyexec_file(const char *filename) { mp_lexer_t *lex = mp_lexer_new_from_file(filename); if (lex == NULL) { diff --git a/stmhal/pyexec.h b/stmhal/pyexec.h index dec241deec..e360273519 100644 --- a/stmhal/pyexec.h +++ b/stmhal/pyexec.h @@ -35,6 +35,6 @@ extern pyexec_mode_kind_t pyexec_mode_kind; int pyexec_raw_repl(void); int pyexec_friendly_repl(void); -bool pyexec_file(const char *filename); +int pyexec_file(const char *filename); MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj); |