diff options
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index e7e35a081a..8b4420926c 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -68,6 +68,15 @@ void mp_init(void) { mp_init_emergency_exception_buf(); #endif + #if MICROPY_KBD_EXCEPTION + // initialise the exception object for raising KeyboardInterrupt + MP_STATE_VM(mp_kbd_exception).base.type = &mp_type_KeyboardInterrupt; + MP_STATE_VM(mp_kbd_exception).traceback_alloc = 0; + MP_STATE_VM(mp_kbd_exception).traceback_len = 0; + MP_STATE_VM(mp_kbd_exception).traceback_data = NULL; + MP_STATE_VM(mp_kbd_exception).args = mp_const_empty_tuple; + #endif + // call port specific initialization if any #ifdef MICROPY_PORT_INIT_FUNC MICROPY_PORT_INIT_FUNC; |