[pypy-svn] r77150 - in pypy/trunk/pypy/module/select: . test

fijal at codespeak.net fijal at codespeak.net
Fri Sep 17 15:46:13 CEST 2010


Author: fijal
Date: Fri Sep 17 15:46:12 2010
New Revision: 77150

Modified:
   pypy/trunk/pypy/module/select/interp_select.py
   pypy/trunk/pypy/module/select/test/test_select.py
Log:
Merge 77128 from rsocket-improvements branch


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	Fri Sep 17 15:46:12 2010
@@ -54,14 +54,11 @@
         if space.is_w(w_timeout, space.w_None):
             timeout = -1
         else:
-            # 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)
+            # we want to be compatible with cpython and also accept things
+            # that can be casted to integer (I think)
             try:
                 # compute the integer
-                timeout = space.int_w(w_timeout)
+                timeout = space.int_w(space.int(w_timeout))
             except (OverflowError, ValueError):
                 raise OperationError(space.w_ValueError,
                                      space.wrap("math range error"))

Modified: pypy/trunk/pypy/module/select/test/test_select.py
==============================================================================
--- pypy/trunk/pypy/module/select/test/test_select.py	(original)
+++ pypy/trunk/pypy/module/select/test/test_select.py	Fri Sep 17 15:46:12 2010
@@ -210,6 +210,14 @@
         assert len(res[2]) == 0
         assert res[0][0] == res[1][0]
 
+    def test_poll(self):
+        import select
+        class A(object):
+            def __int__(self):
+                return 3
+        
+        select.poll().poll(A()) # assert did not crash
+
 class AppTestSelectWithPipes(_AppTestSelect):
     "Use a pipe to get pairs of file descriptors"
     def setup_class(cls):
@@ -275,4 +283,3 @@
         s1, addr2 = cls.sock.accept()
 
         return s1, s2
-



More information about the Pypy-commit mailing list