[pypy-svn] r60432 - in pypy/branch/oo-jit/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Dec 11 19:15:25 CET 2008
Author: arigo
Date: Thu Dec 11 19:15:25 2008
New Revision: 60432
Modified:
pypy/branch/oo-jit/pypy/rpython/rpbc.py
pypy/branch/oo-jit/pypy/rpython/test/test_remptydict.py
Log:
Corner case.
Modified: pypy/branch/oo-jit/pypy/rpython/rpbc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/rpbc.py (original)
+++ pypy/branch/oo-jit/pypy/rpython/rpbc.py Thu Dec 11 19:15:25 2008
@@ -621,6 +621,13 @@
return pair(r_from.r_im_self, r_to.r_im_self).convert_from_to(v, llops)
# __ None ____________________________________________________
+def null_hash(x):
+ assert x is None
+ return 0
+def null_eq(x, y):
+ assert x is y is None
+ return True
+
class NoneFrozenPBCRepr(Repr):
lowleveltype = Void
@@ -630,6 +637,12 @@
def none_call(self, hop):
raise TyperError("attempt to call constant None")
+ def get_ll_hash_function(self):
+ return null_hash
+
+ def get_ll_eq_function(self):
+ return null_eq
+
rtype_simple_call = none_call
rtype_call_args = none_call
Modified: pypy/branch/oo-jit/pypy/rpython/test/test_remptydict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/test/test_remptydict.py (original)
+++ pypy/branch/oo-jit/pypy/rpython/test/test_remptydict.py Thu Dec 11 19:15:25 2008
@@ -43,6 +43,15 @@
res = self.interpret(func, [])
assert res is False
+ def test_none_key_dict(self):
+ def g(x):
+ return x + 17
+ def func(x):
+ d = {None: g}
+ return d[None](x)
+ res = self.interpret(func, [25])
+ assert res == 42
+
class TestLLtype(BaseTestRemptydict, LLRtypeMixin):
pass
More information about the Pypy-commit
mailing list