cpython: f54bc2c52dfd (original) (raw)

Mercurial > cpython

changeset 95314:f54bc2c52dfd

Issue #23485: select.devpoll.poll() is now retried when interrupted by a signal [#23485]

Victor Stinner victor.stinner@gmail.com
date Tue, 31 Mar 2015 12:10:33 +0200
parents b017ca5d28bc
children 76d297869859
files Doc/library/select.rst Doc/whatsnew/3.5.rst Lib/selectors.py Lib/test/eintrdata/eintr_tester.py Modules/selectmodule.c
diffstat 5 files changed, 85 insertions(+), 49 deletions(-)[+] [-] Doc/library/select.rst 6 Doc/whatsnew/3.5.rst 4 Lib/selectors.py 7 Lib/test/eintrdata/eintr_tester.py 11 Modules/selectmodule.c 106

line wrap: on

line diff

--- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -249,6 +249,12 @@ object. returning. If timeout is omitted, -1, or :const:None, the call will block until there is an event for this poll object.

+ .. _epoll-objects:

--- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -619,10 +619,10 @@ Changes in the Python API instead of raising :exc:InterruptedError if the signal handler does not raise an exception:

--- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -479,11 +479,10 @@ if hasattr(select, 'devpoll'): # devpoll() has a resolution of 1 millisecond, round away from # zero to wait at least timeout seconds. timeout = math.ceil(timeout * 1e3) +

+ ready = []

--- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -351,6 +351,17 @@ class SelectEINTRTest(EINTRBaseTest): self.stop_alarm() self.assertGreaterEqual(dt, self.sleep_time)

+

+ def test_main(): support.run_unittest(

--- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -876,40 +876,38 @@ static PyObject * devpoll_poll(devpollObject *self, PyObject *args) { struct dvpoll dvp;

if (self->fd_devpoll < 0) return devpoll_err_closed();

+

+

+

+

if (poll_result < 0) { PyErr_SetFromErrno(PyExc_IOError); @@ -930,28 +952,26 @@ devpoll_poll(devpollObject self, PyObje } / build the result list */ - result_list = PyList_New(poll_result); if (!result_list) return NULL;

+