From 3376875bc8bc7d6854823dcb2c4b763d7c582a99 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky <pfalcon@users.sourceforge.net> Date: Wed, 2 Dec 2015 00:37:14 +0200 Subject: [PATCH] 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. --- unix/modtime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unix/modtime.c b/unix/modtime.c index 0c3324947..2a907a773 100644 --- a/unix/modtime.c +++ b/unix/modtime.c @@ -125,6 +125,9 @@ STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) { if (res != -1 || errno != EINTR) { break; } + if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) { + return mp_const_none; + } //printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec); #else break; -- GitLab