mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
09354fd606
commit
11da8e24ba
4 changed files with 40 additions and 14 deletions
|
@ -8,6 +8,7 @@ This module allows high-level and efficient I/O multiplexing, built upon the
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from collections import namedtuple, Mapping
|
||||
import functools
|
||||
import math
|
||||
import select
|
||||
import sys
|
||||
|
||||
|
@ -351,7 +352,12 @@ if hasattr(select, 'poll'):
|
|||
return key
|
||||
|
||||
def select(self, timeout=None):
|
||||
timeout = None if timeout is None else max(int(1000 * timeout), 0)
|
||||
if timeout is None:
|
||||
timeout = None
|
||||
elif timeout < 0:
|
||||
timeout = 0
|
||||
else:
|
||||
timeout = int(math.ceil(timeout * 1000.0))
|
||||
ready = []
|
||||
try:
|
||||
fd_event_list = self._poll.poll(timeout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue