[pypy-svn] r40577 - in pypy/dist/pypy/rpython: . test
mwh at codespeak.net
mwh at codespeak.net
Fri Mar 16 12:33:09 CET 2007
Author: mwh
Date: Fri Mar 16 12:33:05 2007
New Revision: 40577
Modified:
pypy/dist/pypy/rpython/rint.py
pypy/dist/pypy/rpython/test/test_rbool.py
Log:
grovel differently, in a way that works in arithmetic mixing bools and
integers.
Modified: pypy/dist/pypy/rpython/rint.py
==============================================================================
--- pypy/dist/pypy/rpython/rint.py (original)
+++ pypy/dist/pypy/rpython/rint.py Fri Mar 16 12:33:05 2007
@@ -205,7 +205,8 @@
# paper and pencil are encouraged for this :)
from pypy.rpython.rbool import bool_repr
- c_zero = inputconst(repr.lowleveltype, hop.args_s[0].knowntype(0))
+ assert isinstance(repr.lowleveltype, Number)
+ c_zero = inputconst(repr.lowleveltype, repr.lowleveltype._default)
if func in ('floordiv', 'floordiv_ovf'):
# return (x/y) - (((x^y)<0)&((x%y)!=0));
Modified: pypy/dist/pypy/rpython/test/test_rbool.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rbool.py (original)
+++ pypy/dist/pypy/rpython/test/test_rbool.py Fri Mar 16 12:33:05 2007
@@ -76,6 +76,13 @@
res = self.interpret(f, [9, 2])
assert self.ll_to_string(res) == '01'
+ def test_bool_int_mixture(self):
+ def f(x, y):
+ return x/y
+ res = self.interpret(f, [True, 1])
+ assert res == 1
+ res = self.interpret(f, [1, True])
+ assert res == 1
class TestLLtype(BaseTestRbool, LLRtypeMixin):
pass
More information about the Pypy-commit
mailing list