diff options
| author | Dan Halbert <halbert@halwitz.org> | 2017-09-06 17:15:47 -0400 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2017-09-06 14:47:23 -0700 |
| commit | acbca4451253d71645669a2137260d1fefaf5ac6 (patch) | |
| tree | 97310cda82b6e59a9cddaebe7dfc76007355bfa2 | |
| parent | c0159c5e80f9ca29ac9cf25602b92cd46f4a762d (diff) | |
Ctrl-C was causing a soft-reset in REPL.
Also allow an immediate ctrl-c in `input()`.
| -rw-r--r-- | atmel-samd/mphalport.c | 6 | ||||
| -rw-r--r-- | lib/utils/pyexec.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/atmel-samd/mphalport.c b/atmel-samd/mphalport.c index 34eecc9ba..c1aebe08a 100644 --- a/atmel-samd/mphalport.c +++ b/atmel-samd/mphalport.c @@ -11,6 +11,7 @@ #include "lib/utils/interrupt_char.h" #include "py/mphal.h" #include "py/mpstate.h" +#include "py/runtime.h" #include "py/smallint.h" #include "shared-bindings/time/__init__.h" @@ -157,6 +158,11 @@ int mp_hal_stdin_rx_chr(void) { #ifdef MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_LOOP #endif + // Check to see if we've been CTRL-Ced by autoreload or the user. Raise the exception if so. + if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) { + mp_handle_pending(); + } + #ifdef USB_REPL if (reload_next_character) { return CHAR_CTRL_D; diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index fc04e3f9f..d95084624 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -121,9 +121,6 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input } else { mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); ret = PYEXEC_EXCEPTION; - if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_KeyboardInterrupt)) { - ret = PYEXEC_FORCED_EXIT; - } } } if (result != NULL) { |
