Commits

Armin Rigo committed cb040bc

Bah, missing case.

  • Participants
  • Parent commits 1212ff3

Comments (0)

Files changed (2)

File pypy/rlib/rarithmetic.py

 def is_valid_int(r):
     if objectmodel.we_are_translated():
         return isinstance(r, int)
-    return type(r) in (int, long) and (
+    return type(r) in (int, long, bool) and (
         -maxint - 1 <= r <= maxint)
 is_valid_int._annspecialcase_ = 'specialize:argtype(0)'
 

File pypy/rlib/test/test_rarithmetic.py

 
     def test_is_valid_int(self):
         def f(x):
-            return is_valid_int(x) * 2 + is_valid_int(x + 0.5)
+            return (is_valid_int(x)     * 4 +
+                    is_valid_int(x > 0) * 2 +
+                    is_valid_int(x + 0.5))
+        assert f(123) == 4 + 2
         res = self.interpret(f, [123])
-        assert res == 2
+        assert res == 4 + 2
 
 class TestLLtype(BaseTestRarithmetic, LLRtypeMixin):
     pass