From b54987bd142444be8544448e91fa99efb8b9fda0 Mon Sep 17 00:00:00 2001 From: Reid Wagner Date: Mon, 23 Oct 2017 09:14:18 -0700 Subject: [PATCH] select: Convert float timeout to int with math.ceil. In CPython, timeout is a float and the value rounded up to the nearest millisecond. --- select/select.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/select/select.py b/select/select.py index 72d125d1..0ba96e16 100644 --- a/select/select.py +++ b/select/select.py @@ -4,6 +4,7 @@ import os import errno import ffilib import utime +import math from uselect import * @@ -92,7 +93,7 @@ class Epoll: return res def poll(self, timeout=-1): - return self.poll_ms(-1 if timeout == -1 else timeout * 1000) + return self.poll_ms(-1 if timeout == -1 else math.ceil(timeout * 1000)) def close(self): os.close(self.epfd)