cpython: 202995833ef4 (original) (raw)

Mercurial > cpython

changeset 93784:202995833ef4

selectors: Make sure EpollSelecrtor.select() works when no FD is registered. Closes issue #23009. [#23009]

Yury Selivanov yselivanov@sprymix.com
date Mon, 08 Dec 2014 12:22:33 -0500
parents dd21f8ef033a(current diff)b2ee06684b6a(diff)
children f7faceb6c60a
files Lib/selectors.py Lib/test/test_selectors.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Lib/selectors.py 7 Lib/test/test_selectors.py 5

line wrap: on

line diff

--- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -418,7 +418,12 @@ if hasattr(select, 'epoll'): # epoll_wait() has a resolution of 1 millisecond, round away # from zero to wait at least timeout seconds. timeout = math.ceil(timeout * 1e3) * 1e-3

+

+ ready = [] try: fd_event_list = self._epoll.poll(timeout, max_ev)

--- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -316,6 +316,11 @@ class BaseSelectorTestCase(unittest.Test self.assertEqual(bufs, [MSG] * NUM_SOCKETS)

+ def test_timeout(self): s = self.SELECTOR() self.addCleanup(s.close)