cpython: 69b1683ee001 (original) (raw)

Mercurial > cpython

changeset 95307:69b1683ee001

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

Victor Stinner victor.stinner@gmail.com
date Mon, 30 Mar 2015 21:38:00 +0200
parents 0591cf5c9ebd
children 5194a84ed9f3
files Doc/library/select.rst Doc/whatsnew/3.5.rst Lib/asyncore.py Lib/selectors.py Lib/test/eintrdata/eintr_tester.py Modules/selectmodule.c
diffstat 6 files changed, 111 insertions(+), 61 deletions(-)[+] [-] Doc/library/select.rst 6 Doc/whatsnew/3.5.rst 2 Lib/asyncore.py 6 Lib/selectors.py 7 Lib/test/eintrdata/eintr_tester.py 20 Modules/selectmodule.c 131

line wrap: on

line diff

--- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -408,6 +408,12 @@ linearly scanned again. :c:func:select returning. If timeout is omitted, negative, or :const:None, the call will block until there is an event for this poll object.

+ .. _kqueue-objects:

--- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -621,7 +621,7 @@ Changes in the Python API

--- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -179,10 +179,8 @@ def poll2(timeout=0.0, map=None): flags |= select.POLLOUT if flags: pollster.register(fd, flags)

+

--- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -359,11 +359,10 @@ if hasattr(select, 'poll'): # poll() 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 @@ -38,8 +38,12 @@ class EINTRBaseTest(unittest.TestCase): cls.signal_period) @classmethod

+

@classmethod @@ -260,7 +264,7 @@ class TimeEINTRTest(EINTRBaseTest): def test_sleep(self): t0 = time.monotonic() time.sleep(self.sleep_time)

@@ -311,7 +315,17 @@ class SelectEINTRTest(EINTRBaseTest): def test_select(self): t0 = time.monotonic() select.select([], [], [], self.sleep_time)

+

+

--- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -279,6 +279,7 @@ select_select(PyObject *self, PyObject * break; } _PyTime_AsTimeval_noraise(timeout, &tv, _PyTime_ROUND_CEILING);

+

+

+

+

+

self->poll_running = 0; if (poll_result < 0) {

+