[pypy-svn] r61099 - pypy/trunk/pypy/module/select

fijal at codespeak.net fijal at codespeak.net
Mon Jan 19 02:05:00 CET 2009


Author: fijal
Date: Mon Jan 19 02:04:59 2009
New Revision: 61099

Modified:
   pypy/trunk/pypy/module/select/interp_select.py
Log:
let's compute int instead of trying too hard. CPython doesn't care
and it makes test blow.


Modified: pypy/trunk/pypy/module/select/interp_select.py
==============================================================================
--- pypy/trunk/pypy/module/select/interp_select.py	(original)
+++ pypy/trunk/pypy/module/select/interp_select.py	Mon Jan 19 02:04:59 2009
@@ -54,11 +54,14 @@
         if space.is_w(w_timeout, space.w_None):
             timeout = -1
         else:
-            timeout = space.float_w(w_timeout)
-            # round non-integral floats upwards (in theory, with timeout=2.5
-            # we should wait at least 2.5ms, so 2ms is not enough)
+            # rationale for computing directly integer, instead
+            # of float + math.cell is that
+            # we have for free overflow check and noone really
+            # cares (since CPython does not try too hard to have
+            # a ceiling of value)
             try:
-                timeout = int(math.ceil(timeout))
+                # compute the integer
+                timeout = space.int_w(w_timeout)
             except (OverflowError, ValueError):
                 raise OperationError(space.w_ValueError,
                                      space.wrap("math range error"))



More information about the Pypy-commit mailing list