[pypy-svn] r62759 - in pypy/trunk/pypy/rpython: lltypesystem test

fijal at codespeak.net fijal at codespeak.net
Mon Mar 9 14:25:33 CET 2009


Author: fijal
Date: Mon Mar  9 14:25:33 2009
New Revision: 62759

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/rdict.py
   pypy/trunk/pypy/rpython/test/test_rdict.py
Log:
now that I know why not, let's explode when we have a prebuilt dictionary
with addresses as keys


Modified: pypy/trunk/pypy/rpython/lltypesystem/rdict.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rdict.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rdict.py	Mon Mar  9 14:25:33 2009
@@ -197,6 +197,7 @@
 
 
     def convert_const(self, dictobj):
+        from pypy.rpython.lltypesystem import llmemory
         # get object from bound dict methods
         #dictobj = getattr(dictobj, '__self__', dictobj) 
         if dictobj is None:
@@ -211,6 +212,8 @@
             l_dict = ll_newdict_size(self.DICT, len(dictobj))
             self.dict_cache[key] = l_dict 
             r_key = self.key_repr
+            if r_key.lowleveltype == llmemory.Address:
+                raise TypeError("No prebuilt dicts of address keys")
             r_value = self.value_repr
             if isinstance(dictobj, objectmodel.r_dict):
                 if self.r_rdict_eqfn.lowleveltype != lltype.Void:

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	Mon Mar  9 14:25:33 2009
@@ -774,10 +774,7 @@
                 ptr = b
             return d[llmemory.cast_ptr_to_adr(ptr)]
 
-        res = self.interpret(func, [0])
-        assert res == 8
-        res = self.interpret(func, [1])
-        assert res == 4
+        py.test.raises(TypeError, self.interpret, func, [0])
 
     # ____________________________________________________________
 



More information about the Pypy-commit mailing list