diff options
Diffstat (limited to 'windows')
-rw-r--r-- | windows/mpconfigport.h | 4 | ||||
-rw-r--r-- | windows/windows_mphal.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h index 844e2618f4..b91662af48 100644 --- a/windows/mpconfigport.h +++ b/windows/mpconfigport.h @@ -104,6 +104,7 @@ #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256) +#define MICROPY_KBD_EXCEPTION (1) #define MICROPY_PORT_INIT_FUNC init() #define MICROPY_PORT_DEINIT_FUNC deinit() @@ -161,8 +162,7 @@ extern const struct _mp_obj_module_t mp_module_time; #if MICROPY_USE_READLINE == 1 #define MICROPY_PORT_ROOT_POINTERS \ - char *readline_hist[50]; \ - mp_obj_t keyboard_interrupt_obj; + char *readline_hist[50]; #endif #define MP_STATE_PORT MP_STATE_VM diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c index 3ad6939059..1dd3105d86 100644 --- a/windows/windows_mphal.c +++ b/windows/windows_mphal.c @@ -79,12 +79,12 @@ void mp_hal_stdio_mode_orig(void) { // the thread created for handling it might not be running yet so we'd miss the notification. BOOL WINAPI console_sighandler(DWORD evt) { if (evt == CTRL_C_EVENT) { - if (MP_STATE_VM(mp_pending_exception) == MP_STATE_VM(keyboard_interrupt_obj)) { + if (MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) { // this is the second time we are called, so die straight away exit(1); } - mp_obj_exception_clear_traceback(MP_STATE_VM(keyboard_interrupt_obj)); - MP_STATE_VM(mp_pending_exception) = MP_STATE_VM(keyboard_interrupt_obj); + mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))); + MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)); return TRUE; } return FALSE; |