Skip to content
Snippets Groups Projects
Commit 3be6984b authored by Damien George's avatar Damien George
Browse files

stmhal: Don't return SystemExit value from parse_compile_execute.

There is no need, since we don't (currently) use the value.
parent 8d62bbd4
Branches
Tags
No related merge requests found
...@@ -91,19 +91,14 @@ int parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, boo ...@@ -91,19 +91,14 @@ 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 // FIXME it could be that an interrupt happens just before we disable it here
usb_vcp_set_interrupt_char(VCP_CHAR_NONE); // disable interrupt usb_vcp_set_interrupt_char(VCP_CHAR_NONE); // disable interrupt
// check for SystemExit // check for SystemExit
mp_obj_t exc = (mp_obj_t)nlr.ret_val; if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
if (mp_obj_is_subclass_fast(mp_obj_get_type(exc), &mp_type_SystemExit)) { // at the moment, the value of SystemExit is unused
// None is an exit value of 0; an int is its value; anything else is 1 ret = PYEXEC_FORCED_EXIT;
mp_obj_t exit_val = mp_obj_exception_get_value(exc); } else {
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);
}
mp_obj_print_exception((mp_obj_t)nlr.ret_val); mp_obj_print_exception((mp_obj_t)nlr.ret_val);
ret = 0; ret = 0;
} }
}
// display debugging info if wanted // display debugging info if wanted
if (is_repl && repl_display_debugging_info) { if (is_repl && repl_display_debugging_info) {
...@@ -269,7 +264,7 @@ friendly_repl_reset: ...@@ -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); mp_lexer_t *lex = mp_lexer_new_from_file(filename);
if (lex == NULL) { if (lex == NULL) {
......
...@@ -35,6 +35,6 @@ extern pyexec_mode_kind_t pyexec_mode_kind; ...@@ -35,6 +35,6 @@ extern pyexec_mode_kind_t pyexec_mode_kind;
int pyexec_raw_repl(void); int pyexec_raw_repl(void);
int pyexec_friendly_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); MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment