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:
Victor Stinner 2014-01-21 01:48:28 +01:00
parent 09354fd606
commit 11da8e24ba
4 changed files with 40 additions and 14 deletions

View file

@ -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)