[pypy-commit] pypy default: Bah, missing case.
arigo
noreply at buildbot.pypy.org
Thu Mar 15 01:48:47 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r53631:cb040bc5d225
Date: 2012-03-14 17:48 -0700
http://bitbucket.org/pypy/pypy/changeset/cb040bc5d225/
Log: Bah, missing case.
diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -139,7 +139,7 @@
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)'
diff --git a/pypy/rlib/test/test_rarithmetic.py b/pypy/rlib/test/test_rarithmetic.py
--- a/pypy/rlib/test/test_rarithmetic.py
+++ b/pypy/rlib/test/test_rarithmetic.py
@@ -332,9 +332,12 @@
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
More information about the pypy-commit
mailing list