diff options
| author | Tony DiCola <tony@tonydicola.com> | 2016-10-20 23:01:13 +0000 |
|---|---|---|
| committer | Tony DiCola <tony@tonydicola.com> | 2016-10-20 23:01:13 +0000 |
| commit | 00a44fa36cd1e35a438c4b89b5cef0bc82787c7a (patch) | |
| tree | 4800a6984902e043e3fc437adcdfcd665f83e220 /lib/utils/pyexec.c | |
| parent | 1f13f870b8f6554d9cd5570de221a6886e065b64 (diff) | |
| parent | 3967ca7390ff8257728ef6237b93977b63bde41d (diff) | |
Merge remote-tracking branch 'micropython/master'
Conflicts:
README.md - Kept Adafruit README.md intact.
py/emitglue.c - Added xtensa architecture as an OR of the define.
zephyr/README.md - Fixed spelling mistake.
Diffstat (limited to 'lib/utils/pyexec.c')
| -rw-r--r-- | lib/utils/pyexec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index bc540199d..f9bbf68a1 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -45,6 +45,7 @@ #include "genhdr/mpversion.h" pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; +int pyexec_system_exit = 0; STATIC bool repl_display_debugging_info = 0; #define EXEC_FLAG_PRINT_EOF (1) @@ -61,6 +62,9 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind, int ret = 0; uint32_t start = 0; + // by default a SystemExit exception returns 0 + pyexec_system_exit = 0; + nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_obj_t module_fun; @@ -99,7 +103,7 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind, // check for SystemExit 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; + ret = pyexec_system_exit; } else { mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); ret = 0; @@ -148,7 +152,7 @@ STATIC int pyexec_raw_repl_process_char(int c); STATIC int pyexec_friendly_repl_process_char(int c); void pyexec_event_repl_init(void) { - MP_STATE_VM(repl_line) = vstr_new_size(32); + MP_STATE_VM(repl_line) = vstr_new(32); repl.cont_line = false; readline_init(MP_STATE_VM(repl_line), ">>> "); if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { |
