[pypy-svn] r66985 - in pypy/branch/pyjitpl5/pypy/rpython: . test

benjamin at codespeak.net benjamin at codespeak.net
Wed Aug 19 17:30:21 CEST 2009


Author: benjamin
Date: Wed Aug 19 17:30:20 2009
New Revision: 66985

Modified:
   pypy/branch/pyjitpl5/pypy/rpython/rclass.py
   pypy/branch/pyjitpl5/pypy/rpython/test/test_rclass.py
   pypy/branch/pyjitpl5/pypy/rpython/test/test_rvirtualizable2.py
Log:
(arigo, benjamin) simplify _immutable_hints_ accessor

Modified: pypy/branch/pyjitpl5/pypy/rpython/rclass.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/rclass.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/rclass.py	Wed Aug 19 17:30:20 2009
@@ -176,8 +176,7 @@
         pass
 
     def _parse_field_list(self, fields, accessor):
-        mangled_fields = {}
-        with_suffix = []
+        with_suffix = {}
         for name in fields:
             if name.endswith('[*]'):
                 name = name[:-3]
@@ -185,10 +184,9 @@
             else:
                 suffix = ''
             mangled_name, r = self._get_field(name)
-            with_suffix.append(mangled_name + suffix)
-            mangled_fields[mangled_name] = True
+            with_suffix[mangled_name] = suffix
         accessor.initialize(self.object_type, with_suffix)
-        return mangled_fields
+        return with_suffix
 
     def new_instance(self, llops, classcallhop=None):
         raise NotImplementedError

Modified: pypy/branch/pyjitpl5/pypy/rpython/test/test_rclass.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/test/test_rclass.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/test/test_rclass.py	Wed Aug 19 17:30:20 2009
@@ -774,7 +774,7 @@
         t, typer, graph = self.gengraph(f, [])
         A_TYPE = graph.getreturnvar().concretetype
         accessor = A_TYPE.TO._hints["immutable_fields"]
-        assert accessor.fields == ["inst_x", "inst_y[*]"]
+        assert accessor.fields == {"inst_x" : "", "inst_y" : "[*]"}
 
     def test_immutable_inheritance(self):
         class I(object):

Modified: pypy/branch/pyjitpl5/pypy/rpython/test/test_rvirtualizable2.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/test/test_rvirtualizable2.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/test/test_rvirtualizable2.py	Wed Aug 19 17:30:20 2009
@@ -76,8 +76,8 @@
         TYPE = self.gettype(v_inst)
         accessor = TYPE._hints['virtualizable2_accessor']
         assert accessor.TYPE == TYPE
-        assert accessor.fields == [self.prefix + 'v1',
-                                   self.prefix + 'v2[*]']
+        assert accessor.fields == {self.prefix + 'v1' : "",
+                                   self.prefix + 'v2': "[*]"}
         #
         def fn2(n):
             Base().base1 = 42



More information about the Pypy-commit mailing list