Commit Graph

56 Commits

Author SHA1 Message Date
Davide Rizzo
b14f0ab51c
gh-110038: KqueueSelector must count all read/write events (#110039) 2023-09-28 17:25:10 +00:00
Pieter Eendebak
832c37d42a
gh-106751: Optimize _PolllikeSelector for many iteration case (gh-106884) 2023-07-20 09:53:11 +09:00
Dong-hee Na
e6f96cf9c6
gh-106751: Optimize SelectSelector.select() for many iteration case (gh-106879) 2023-07-19 15:12:38 +09:00
Dong-hee Na
7513e2e7e4
gh-106751: Optimize KqueueSelector.select() for many iteration case (gh-106864) 2023-07-19 10:18:23 +09:00
J. Nick Koston
aecf6aca51
gh-106751: selectors: optimize EpollSelector.select() (#106754)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2023-07-18 10:16:32 +00:00
J. Nick Koston
aeef8591e4
gh-106554: replace _BaseSelectorImpl._key_from_fd with dict.get (#106555) 2023-07-15 03:46:30 +09:00
J. Nick Koston
8d2f3c36ca
gh-106664: selectors: add get() method to _SelectorMapping (#106665)
It can be used to avoid raising and catching KeyError twice via __getitem__.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2023-07-13 19:18:53 +00:00
Nikita Sobolev
3483aa65df
bpo-46583: remove unused sys.version_info check from selectors (GH-31023) 2022-02-02 10:15:02 +02:00
Abhijeet Kasurde
bcd47837a9
bpo-41182 selector: use DefaultSelector based upon implementation (GH-21257)
On some platform such as VMware ESXi, DefaultSelector fails
to detect selector due to default value.
This fix adds a check and uses the correct selector depending upon
select implementation and actual call.

Fixes: [bpo-41182]()

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-07-22 20:13:37 -07:00
Russell Davis
ba1bcffe5c
bpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)
Also partially fixes bpo-25680 (there's still a discrepancy in behavior
on Windows that needs to be fixed).
2020-04-15 11:57:06 -07:00
Giampaolo Rodola
ced36a993f bpo-30624 remaining bare except (#2108)
bpo-30624 / selectors: use bare 'except' clause instead of 'except
Exception'
2017-06-12 14:43:40 +02:00
Giampaolo Rodola
05dc20f992 #30624 / selectors: use bare except clause in order to not leave the fd in a bad state in case of error (#2082) 2017-06-10 16:51:52 -07:00
Giampaolo Rodola
fbfaa6fd57 bpo-30014: make poll-like selector's modify() method faster (#1030)
* #30014: make selectors.DefaultSelector.modify() faster by relying on selector's modify() method instead of un/register()ing the fd

* #30014: add unit test

* speedup poll/epoll/devpoll modify() method by using internal modify() call

* update doc

* address PR comments

* update NEWS entries

* use != instead of 'is not'
2017-06-09 22:20:41 +02:00
Giampaolo Rodola
62c7d90b64 #30014: refactor poll-related classes (#1035)
* #30014: refactor poll-related classes so that poll(), epoll() and devpoll() share the same methods for register(), unregister(), close() and select()

* remove unused attribute

* use specific class attributes instead of select.* constants

* have all classes except SelectSelector a _selector attribute

* BaseException -> Exception

* be explicit in defining a close() method only for selectors which have it

* fix AttributeError
2017-05-20 11:34:44 +02:00
Serhiy Storchaka
2e576f5aec bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2017-04-24 09:05:00 +03:00
Yury Selivanov
525aedc5fa Issue #27759: Fix selectors incorrectly retain invalid file descriptors.
Patch by Mark Williams.
2016-09-15 19:30:42 -04:00
Yury Selivanov
0c6a34409e asyncio, selectors: Update to the upstream version 2016-03-02 10:37:59 -05:00
Yury Selivanov
90ecfe65e6 asyncio: Sync with github repo 2015-05-11 13:48:16 -04:00
Serhiy Storchaka
2116b12da5 Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:29:28 +03:00
Serhiy Storchaka
7e7a3dba5f Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:24:41 +03:00
Victor Stinner
45ca48b03d Issue #23485: select.devpoll.poll() is now retried when interrupted by a signal 2015-03-31 12:10:33 +02:00
Victor Stinner
4448c08451 Issue #23485: select.kqueue.control() is now retried when interrupted by a signal 2015-03-31 11:48:34 +02:00
Victor Stinner
41eba224de Issue #23485: select.epoll.poll() is now retried when interrupted by a signal 2015-03-30 21:59:21 +02:00
Victor Stinner
3c7d6e0693 Issue #23485: select.poll.poll() is now retried when interrupted by a signal 2015-03-30 21:38:00 +02:00
Victor Stinner
f70e1ca0fc Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.

The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
2015-03-30 21:16:11 +02:00
Victor Stinner
458fc6f98c Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a
RuntimeError if the selector is closed. And selectors.BaseSelector.close() now
clears its internal reference to the selector mapping to break a reference
cycle. Initial patch written by Martin Richard.
2015-01-13 10:00:55 +01:00
Victor Stinner
38dc250521 Issue #23209, #23225: selectors.BaseSelector.close() now clears its internal
reference to the selector mapping to break a reference cycle. Initial patch
written by Martin Richard.
2015-01-13 09:58:33 +01:00
Victor Stinner
c50a9c1617 (Merge 3.4) Issue #23209: Revert change on selectors, test_selectors failed. 2015-01-09 21:57:19 +01:00
Victor Stinner
686fe6e156 Issue #23209: Revert change on selectors, test_selectors failed. 2015-01-09 21:56:28 +01:00
Victor Stinner
6a825a8314 Merge 3.4 (asyncio, selectors) 2015-01-09 21:35:03 +01:00
Victor Stinner
587feb19e8 Issue #23209: Break some reference cycles in asyncio. Patch written by Martin
Richard.
2015-01-09 21:34:27 +01:00
Victor Stinner
53a6d74fbf selectors: truncate to 80 characters 2015-01-09 00:13:39 +01:00
Yury Selivanov
dfc44e0525 selectors: Fix typo in comment. 2014-12-08 12:30:10 -05:00
Yury Selivanov
d60ef4aa9d selectors: Make sure EpollSelecrtor.select() works when no FD is registered.
Closes issue #23009.
2014-12-08 12:21:58 -05:00
Yury Selivanov
c57ca93a78 selectors: Fix typo in comment. 2014-12-08 12:30:28 -05:00
Yury Selivanov
7f98d3ecb8 selectors: Make sure EpollSelecrtor.select() works when no FD is registered.
Closes issue #23009.
2014-12-08 12:22:33 -05:00
Giampaolo Rodola'
f97e82937f Fix issue 18931: selectors module now supports /dev/poll on Solaris. 2014-03-20 21:43:41 +01:00
Victor Stinner
da492a8c39 asyncio: remove unused imports and unused variables noticed by pyflakes 2014-02-20 10:37:27 +01:00
Yury Selivanov
b0b0e628ee asyncio: Fix spelling and typos.
Thanks to Vajrasky Kok for discovering some of them.
2014-02-18 22:27:48 -05:00
Victor Stinner
b4c9388947 asyncio: remove unused imports and unused variables noticed by pyflakes 2014-02-20 10:37:27 +01:00
Yury Selivanov
dec1a45fd1 asyncio: Fix spelling and typos.
Thanks to Vajrasky Kok for discovering some of them.
2014-02-18 22:27:48 -05:00
Victor Stinner
85310a50a9 Issue #20505: Remove resolution and _granularity from selectors and asyncio
* Remove selectors.BaseSelector.resolution attribute
* Remove asyncio.BaseEventLoop._granularity attribute
2014-02-07 23:34:58 +01:00
Victor Stinner
665758f804 Issue #20455: math.ceil() returns an int in Python 3, no need to cast the
result again to int
2014-01-31 16:24:21 +01:00
Victor Stinner
dcd9740ad2 Issue #20452: select and selectors round (again) timeout away from zero for
poll and epoll

Improve also debug info to analyze the issue
2014-01-31 12:12:53 +01:00
Victor Stinner
635fca9704 Issue #20311: selectors: Add a resolution attribute to BaseSelector. 2014-01-25 14:56:48 +01:00
Victor Stinner
2041859f27 Issue #20311: Revert e042ea77a152 and 7ce7295393c2, PollSelector.select() and
EpollSelector.select() round again the timeout towards zero
2014-01-25 14:43:45 +01:00
Victor Stinner
567b26e882 Issue #20311: EpollSelector now also rounds the timeout towards zero, as
PollSelector.

This change is not really required in Python 3.4, since select.epoll.poll() now
rounds also correctly the timeout. But Guido van Rossum prefers to have exactly
the same selectors.py file in CPython and Tulip projects: "it's not harmful".
2014-01-21 21:00:47 +01:00
Victor Stinner
7067b5d927 selectors: add a comment to explain why and how poll timeout is rounded 2014-01-21 17:49:41 +01:00
Victor Stinner
11da8e24ba Issue #20311: selector.PollSelector.select() now rounds the timeout away from
zero, instead of rounding towards zero. For example, a timeout of one
microsecond is now rounded to one millisecond, instead of being rounded to
zero.

Move also a test in test_epoll which was moved by my previous merge.
2014-01-21 01:48:28 +01:00
Guido van Rossum
9710ff04ac Silently ignore unregistering closed files. Fixes issue 19876. With docs and slight test refactor. 2013-12-07 15:57:01 -08:00