Skip to content

Commit 6a76e15

Browse files
authored
Added stack trace after a sleep ctrl-c interrupt
1 parent 47425f2 commit 6a76e15

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shared-module/time/__init__.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "supervisor/port.h"
2929
#include "supervisor/shared/tick.h"
3030
#include "py/obj.h"
31+
#include "py/nlr.h"
3132
#include "py/mpstate.h"
3233

3334
uint64_t common_hal_time_monotonic(void) {
@@ -47,6 +48,7 @@ void common_hal_time_delay_ms(uint32_t delay) {
4748
// if the delay was cut short by a CTRL-C then clear the keyboard exception
4849
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
4950
{
50-
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
51+
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
52+
nlr_raise(mp_obj_new_exception(&mp_type_KeyboardInterrupt));
5153
}
5254
}

0 commit comments

Comments
 (0)