[pypy-svn] r57808 - in pypy/branch/oo-jit/pypy/rpython: . test

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 4 15:07:22 CEST 2008


Author: antocuni
Date: Thu Sep  4 15:07:19 2008
New Revision: 57808

Modified:
   pypy/branch/oo-jit/pypy/rpython/rpbc.py
   pypy/branch/oo-jit/pypy/rpython/test/test_rdict.py
Log:
always return None when convert_const() a SingleFrozenPBCRepr; this fixes the
test



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 Sep  4 15:07:19 2008
@@ -403,6 +403,9 @@
             raise TyperError("getattr on a constant PBC returns a non-constant")
         return hop.inputconst(hop.r_result, hop.s_result.const)
 
+    def convert_const(self, value):
+        return None
+
     def convert_desc(self, frozendesc):
         assert frozendesc is self.frozendesc
         return object()  # lowleveltype is Void

Modified: pypy/branch/oo-jit/pypy/rpython/test/test_rdict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/test/test_rdict.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/test/test_rdict.py	Thu Sep  4 15:07:19 2008
@@ -496,6 +496,17 @@
         res = self.interpret(g, [3])
         assert res == 77
 
+    def test_singlefrozenpbc_as_value(self):
+        class A:
+            def _freeze_(self):
+                return True
+        a = A()
+        d = {42: a}
+        def fn(key):
+            return d[key]
+        res = self.interpret(fn, [42])
+        assert res is None
+
 
 class TestLLtype(BaseTestRdict, LLRtypeMixin):
     def test_dict_but_not_with_char_keys(self):



More information about the Pypy-commit mailing list