cpython: 0a51a516bc70 (original) (raw)

Mercurial > cpython

changeset 89890:0a51a516bc70

Fix issue 18931: selectors module now supports /dev/poll on Solaris. [#18931]

Giampaolo Rodola' g.rodola@gmail.com
date Thu, 20 Mar 2014 21:43:41 +0100
parents 2e4692a762d5
children cbb18e801505
files Doc/library/selectors.rst Lib/selectors.py Lib/test/test_selectors.py Misc/NEWS
diffstat 4 files changed, 84 insertions(+), 2 deletions(-)[+] [-] Doc/library/selectors.rst 11 Lib/selectors.py 62 Lib/test/test_selectors.py 10 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -45,6 +45,7 @@ Classes hierarchy:: +-- SelectSelector +-- PollSelector +-- EpollSelector

@@ -207,6 +208,16 @@ below: This returns the file descriptor used by the underlying :func:select.epoll object. +.. class:: DevpollSelector() +

+ +.. versionadded:: 3.5 .. class:: KqueueSelector()

--- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -441,6 +441,64 @@ if hasattr(select, 'epoll'): super().close() +if hasattr(select, 'devpoll'): +

+

+

+

+

+

+

+

+ + if hasattr(select, 'kqueue'): class KqueueSelector(_BaseSelectorImpl): @@ -513,12 +571,14 @@ if hasattr(select, 'kqueue'): super().close() -# Choose the best implementation: roughly, epoll|kqueue > poll > select. +# Choose the best implementation: roughly, epoll|kqueue|devpoll > poll > select.

select() also can't accept a FD > FD_SETSIZE (usually around 1024)

if 'KqueueSelector' in globals(): DefaultSelector = KqueueSelector elif 'EpollSelector' in globals(): DefaultSelector = EpollSelector +elif 'DevpollSelector' in globals():

elif 'PollSelector' in globals(): DefaultSelector = PollSelector else:

--- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -441,10 +441,18 @@ class KqueueSelectorTestCase(BaseSelecto SELECTOR = getattr(selectors, 'KqueueSelector', None) +@unittest.skipUnless(hasattr(selectors, 'DevpollSelector'),

+class DevpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn): +

+ + + def test_main(): tests = [DefaultSelectorTestCase, SelectSelectorTestCase, PollSelectorTestCase, EpollSelectorTestCase,

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -23,6 +23,9 @@ Core and Builtins Library ------- +- Issue 18931: selectors module now supports /dev/poll on Solaris.