summaryrefslogtreecommitdiff
path: root/Lib/selectors.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/selectors.py')
-rw-r--r--Lib/selectors.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/selectors.py b/Lib/selectors.py
index a9a0801ef0..90251dc34a 100644
--- a/Lib/selectors.py
+++ b/Lib/selectors.py
@@ -552,7 +552,10 @@ if hasattr(select, 'kqueue'):
def select(self, timeout=None):
timeout = None if timeout is None else max(timeout, 0)
- max_ev = len(self._fd_to_key)
+ # If max_ev is 0, kqueue will ignore the timeout. For consistent
+ # behavior with the other selector classes, we prevent that here
+ # (using max). See https://bugs.python.org/issue29255
+ max_ev = max(len(self._fd_to_key), 1)
ready = []
try:
kev_list = self._selector.control(None, max_ev, timeout)