Author: Timo Paulssen <timona...@perpetuum-immobile.de>
Branch: 
Changeset: r48467:b5bd720602fb
Date: 2011-10-26 03:00 +0200
http://bitbucket.org/pypy/pypy/changeset/b5bd720602fb/

Log:    raise an IOError when sleeping for negative time (Issue922)

diff --git a/pypy/module/rctime/interp_time.py 
b/pypy/module/rctime/interp_time.py
--- a/pypy/module/rctime/interp_time.py
+++ b/pypy/module/rctime/interp_time.py
@@ -245,6 +245,9 @@
 if sys.platform != 'win32':
     @unwrap_spec(secs=float)
     def sleep(space, secs):
+        if secs < 0:
+            raise space.OperationError(space.w_IOError,
+                                       space.wrap("Invalid argument: negative 
time in sleep"))
         pytime.sleep(secs)
 else:
     from pypy.rlib import rwin32
@@ -265,6 +268,9 @@
                                    OSError(EINTR, "sleep() interrupted"))
     @unwrap_spec(secs=float)
     def sleep(space, secs):
+        if secs < 0:
+            raise space.OperationError(space.w_IOError,
+                                       space.wrap("Invalid argument: negative 
time in sleep"))
         # as decreed by Guido, only the main thread can be
         # interrupted.
         main_thread = space.fromcache(State).main_thread
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to