diff --git a/extmod/modmachine.c b/extmod/modmachine.c index 2fe72817b6..a423d8067c 100644 --- a/extmod/modmachine.c +++ b/extmod/modmachine.c @@ -62,7 +62,6 @@ NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args); #endif static mp_obj_t machine_soft_reset(void) { - pyexec_system_exit = PYEXEC_FORCED_EXIT; mp_raise_type(&mp_type_SystemExit); } static MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset); diff --git a/ports/qemu-arm/modmachine.c b/ports/qemu-arm/modmachine.c index 5f6db937c3..a897c5670e 100644 --- a/ports/qemu-arm/modmachine.c +++ b/ports/qemu-arm/modmachine.c @@ -27,9 +27,6 @@ // This file is never compiled standalone, it's included directly from // extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE. -// This variable is needed for machine.soft_reset(), but the variable is otherwise unused. -int pyexec_system_exit = 0; - static void mp_machine_idle(void) { // Do nothing. } diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c index 6f3ab80944..d1cdbe8619 100644 --- a/ports/unix/modmachine.c +++ b/ports/unix/modmachine.c @@ -36,9 +36,6 @@ #define MICROPY_PAGE_MASK (MICROPY_PAGE_SIZE - 1) #endif -// This variable is needed for machine.soft_reset(), but the variable is otherwise unused. -int pyexec_system_exit = 0; - uintptr_t mod_machine_mem_get_addr(mp_obj_t addr_o, uint align) { uintptr_t addr = mp_obj_get_int_truncated(addr_o); if ((addr & (align - 1)) != 0) { diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index a305e6a5df..9dc4446ed4 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -44,7 +44,6 @@ #include "genhdr/mpversion.h" pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; -int pyexec_system_exit = 0; #if MICROPY_REPL_INFO static bool repl_display_debugging_info = 0; @@ -74,9 +73,6 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input MICROPY_BOARD_BEFORE_PYTHON_EXEC(input_kind, exec_flags); #endif - // by default a SystemExit exception returns 0 - pyexec_system_exit = 0; - nlr_buf_t nlr; nlr.ret_val = NULL; if (nlr_push(&nlr) == 0) { @@ -146,7 +142,7 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input // check for SystemExit if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t *)nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) { // at the moment, the value of SystemExit is unused - ret = pyexec_system_exit; + ret = PYEXEC_FORCED_EXIT; } else { mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); ret = 0; diff --git a/shared/runtime/pyexec.h b/shared/runtime/pyexec.h index 64c5ef9434..5779d3e09a 100644 --- a/shared/runtime/pyexec.h +++ b/shared/runtime/pyexec.h @@ -35,11 +35,6 @@ typedef enum { extern pyexec_mode_kind_t pyexec_mode_kind; -// Set this to the value (eg PYEXEC_FORCED_EXIT) that will be propagated through -// the pyexec functions if a SystemExit exception is raised by the running code. -// It will reset to 0 at the start of each execution (eg each REPL entry). -extern int pyexec_system_exit; - #define PYEXEC_FORCED_EXIT (0x100) int pyexec_raw_repl(void);