diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-19 22:33:09 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-19 22:33:09 (GMT) |
commit | 54799672dad9e6a10adde0f4af87d9f8165e4d7a (patch) | |
tree | f3396b8c4313ff3f5d3c24f76311eb5382ee4e97 /Modules/selectmodule.c | |
parent | c7cd12da6062e19625cfef38aa25ed58a6109fa1 (diff) | |
download | cpython-54799672dad9e6a10adde0f4af87d9f8165e4d7a.zip cpython-54799672dad9e6a10adde0f4af87d9f8165e4d7a.tar.gz cpython-54799672dad9e6a10adde0f4af87d9f8165e4d7a.tar.bz2 |
Issue #23708: select.devpoll now retries its internal write() when interrupted
by a signal (EINTR).
Modify devpoll_flush() to use _Py_write() instead of calling directly write().
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r-- | Modules/selectmodule.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index ef53067..a65af2f 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -718,14 +718,10 @@ static int devpoll_flush(devpollObject *self) size = sizeof(struct pollfd)*self->n_fds; self->n_fds = 0; - Py_BEGIN_ALLOW_THREADS - n = write(self->fd_devpoll, self->fds, size); - Py_END_ALLOW_THREADS - - if (n == -1 ) { - PyErr_SetFromErrno(PyExc_IOError); + n = _Py_write(self->fd_devpoll, self->fds, size); + if (n == -1) return -1; - } + if (n < size) { /* ** Data writed to /dev/poll is a binary data structure. It is not |