Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r70606:f4ed04b53800
Date: 2014-04-12 18:36 +0200
http://bitbucket.org/pypy/pypy/changeset/f4ed04b53800/

Log:    Don't accept -1 as select() timeout.

diff --git a/pypy/module/select/interp_select.py 
b/pypy/module/select/interp_select.py
--- a/pypy/module/select/interp_select.py
+++ b/pypy/module/select/interp_select.py
@@ -174,6 +174,9 @@
         timeout = -1.0
     else:
         timeout = space.float_w(w_timeout)
+        if timeout < 0.0:
+            raise OperationError(space.w_ValueError,
+                                 space.wrap("timeout must be non-negative"))
 
     ll_inl  = lltype.nullptr(_c.fd_set.TO)
     ll_outl = lltype.nullptr(_c.fd_set.TO)
diff --git a/pypy/module/select/test/test_select.py 
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -22,6 +22,7 @@
         finally:
             readend.close()
             writeend.close()
+        raises(ValueError, select.select, [], [], [], -1)
 
     def test_list_tuple(self):
         import time, select
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to