mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)
select() calls are retried on EINTR (per PEP 475). However, if a timeout was provided and the deadline has passed after running the signal handlers, rlist, wlist and xlist should be cleared since select(2) left them unmodified.
This commit is contained in:
parent
67a93b3a0b
commit
7f52415a6d
2 changed files with 8 additions and 0 deletions
|
|
@ -335,6 +335,10 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
|
|||
if (tvp) {
|
||||
timeout = deadline - _PyTime_GetMonotonicClock();
|
||||
if (timeout < 0) {
|
||||
/* bpo-35310: lists were unmodified -- clear them explicitly */
|
||||
FD_ZERO(&ifdset);
|
||||
FD_ZERO(&ofdset);
|
||||
FD_ZERO(&efdset);
|
||||
n = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue