[Python-checkins] cpython: Issue #23708: select.devpoll now retries its internal write() when interrupted

victor.stinner python-checkins at python.org
Thu Mar 19 23:33:55 CET 2015


https://hg.python.org/cpython/rev/e232b57ee784
changeset: 95072:e232b57ee784
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Mar 19 23:33:09 2015 +0100
summary:
 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().
files:
 Modules/selectmodule.c | 10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -718,14 +718,10 @@
 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
+ n = _Py_write(self->fd_devpoll, self->fds, size);
+ if (n == -1)
+ return -1;
 
- if (n == -1 ) {
- PyErr_SetFromErrno(PyExc_IOError);
- return -1;
- }
 if (n < size) {
 /*
 ** Data writed to /dev/poll is a binary data structure. It is not
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /