Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r93560:36cb02a2cd90
Date: 2017-12-25 09:30 +0100
http://bitbucket.org/pypy/pypy/changeset/36cb02a2cd90/

Log:    Fix 248a5a9859ef (probably)

diff --git a/pypy/interpreter/timeutils.py b/pypy/interpreter/timeutils.py
--- a/pypy/interpreter/timeutils.py
+++ b/pypy/interpreter/timeutils.py
@@ -4,6 +4,7 @@
 import math
 from rpython.rlib.rarithmetic import (
     r_longlong, ovfcheck, ovfcheck_float_to_longlong)
+from rpython.rlib import rfloat
 from pypy.interpreter.error import oefmt
 
 SECS_TO_NS = 10 ** 9
@@ -21,6 +22,8 @@
 def timestamp_w(space, w_secs):
     if space.isinstance_w(w_secs, space.w_float):
         secs = space.float_w(w_secs)
+        if rfloat.isnan(secs):
+            raise oefmt(space.w_ValueError, "timestamp is nan")
         result_float = math.ceil(secs * SECS_TO_NS)
         try:
             return ovfcheck_float_to_longlong(result_float)
diff --git a/pypy/module/time/test/test_time.py 
b/pypy/module/time/test/test_time.py
--- a/pypy/module/time/test/test_time.py
+++ b/pypy/module/time/test/test_time.py
@@ -13,12 +13,10 @@
         assert isinstance(time._STRUCT_TM_ITEMS, int)
 
     def test_sleep(self):
-        import time, sys
+        import time
         raises(TypeError, time.sleep, "foo")
         time.sleep(0.12345)
         raises(ValueError, time.sleep, -1.0)
-        if sys.platform == 'win32':
-            assert False, 'hangs on win32 after translation'
         raises((ValueError, OverflowError), time.sleep, float('nan'))
         raises(OverflowError, time.sleep, float('inf'))
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to