diff options
| author | Damien George <damien.p.george@gmail.com> | 2017-04-10 17:17:22 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2017-04-11 13:31:49 +1000 |
| commit | 6c564aa408faf5d2769785b7ffc438a489310c3b (patch) | |
| tree | f58cfa8723b2c71b624c4b9ed4580443d1d45458 /windows | |
| parent | 9156c8b460a4b013312466744b47bc4bb5506269 (diff) | |
unix, windows: Use core-provided KeyboardInterrupt exception object.
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 844e2618f..b91662af4 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 3ad693905..1dd3105d8 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; |
