diff --git a/Misc/NEWS.d/next/Library/2018-11-25-14-53-00.bpo-35310.75QGfz.rst b/Misc/NEWS.d/next/Library/2018-11-25-14-53-00.bpo-35310.75QGfz.rst new file mode 100644 index 00000000000000..586db9fc1f61be --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-11-25-14-53-00.bpo-35310.75QGfz.rst @@ -0,0 +1,3 @@ +Fix a bug in ``select.select()`` where a retry does not occur on EINTR if the +deadline has already passed after running the signal handlers. Patch by Oran +Avraham. diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index d86727a8978dc0..69d2a2b7eb67fa 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -335,8 +335,8 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, if (tvp) { timeout = deadline - _PyTime_GetMonotonicClock(); if (timeout < 0) { - n = 0; - break; + timeout = 0; + /* retry select() with a non-blocking call */ } _PyTime_AsTimeval_noraise(timeout, &tv, _PyTime_ROUND_CEILING); /* retry select() with the recomputed timeout */