Skip to content

Commit 3376875

Browse files
committed
unix/modtime: sleep(): Return early if KeyboardInterrupt is pending
As set by signal handler. This assumes that exception will be raised somewhere else, which so far doesn't happen for single function call. Still, it makes sense to handle that in some common place.
1 parent 0d9b450 commit 3376875

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

unix/modtime.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) {
125125
if (res != -1 || errno != EINTR) {
126126
break;
127127
}
128+
if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) {
129+
return mp_const_none;
130+
}
128131
//printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec);
129132
#else
130133
break;

0 commit comments

Comments
 (0)