[pypy-svn] r68693 - in pypy/trunk/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Oct 21 18:32:20 CEST 2009
Author: arigo
Date: Wed Oct 21 18:32:17 2009
New Revision: 68693
Modified:
pypy/trunk/pypy/rpython/rint.py
pypy/trunk/pypy/rpython/test/test_rdict.py
Log:
Fix ll_hash_int. Can you believe it.
(merged from r68673)
Modified: pypy/trunk/pypy/rpython/rint.py
==============================================================================
--- pypy/trunk/pypy/rpython/rint.py (original)
+++ pypy/trunk/pypy/rpython/rint.py Wed Oct 21 18:32:17 2009
@@ -408,10 +408,8 @@
fn = hop.rtyper.type_system.ll_str.ll_int2oct
return hop.gendirectcall(fn, varg, true)
-def ll_identity(n):
- return n
-
-ll_hash_int = ll_identity
+def ll_hash_int(n):
+ return intmask(n)
def ll_check_chr(n):
if 0 <= n <= 255:
Modified: pypy/trunk/pypy/rpython/test/test_rdict.py
==============================================================================
--- pypy/trunk/pypy/rpython/test/test_rdict.py (original)
+++ pypy/trunk/pypy/rpython/test/test_rdict.py Wed Oct 21 18:32:17 2009
@@ -4,6 +4,7 @@
from pypy.rpython.lltypesystem import rdict, rstr
from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
from pypy.rlib.objectmodel import r_dict
+from pypy.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong
import py
py.log.setconsumer("rtyper", py.log.STDOUT)
@@ -564,6 +565,17 @@
res = self.interpret(fn, [3.0])
assert res == 42
+ def test_dict_of_r_uint(self):
+ for r_t in [r_uint, r_longlong, r_ulonglong]:
+ d = {r_t(2): 3, r_t(4): 5}
+ def fn(x, y):
+ d[r_t(x)] = 123
+ return d[r_t(y)]
+ res = self.interpret(fn, [4, 2])
+ assert res == 3
+ res = self.interpret(fn, [3, 3])
+ assert res == 123
+
class TestLLtype(BaseTestRdict, LLRtypeMixin):
def test_dict_but_not_with_char_keys(self):
More information about the Pypy-commit
mailing list