[pypy-svn] r18984 - in pypy/dist/pypy/translator: c c/test goal

pedronis at codespeak.net pedronis at codespeak.net
Wed Oct 26 04:23:02 CEST 2005


Author: pedronis
Date: Wed Oct 26 04:23:01 2005
New Revision: 18984

Modified:
   pypy/dist/pypy/translator/c/symboltable.py
   pypy/dist/pypy/translator/c/test/test_symboltable.py
   pypy/dist/pypy/translator/goal/targetrpystonex.py
Log:
support adt methods in debugptr too.

use it with symboltable code



Modified: pypy/dist/pypy/translator/c/symboltable.py
==============================================================================
--- pypy/dist/pypy/translator/c/symboltable.py	(original)
+++ pypy/dist/pypy/translator/c/symboltable.py	Wed Oct 26 04:23:01 2005
@@ -127,10 +127,15 @@
             try:
                 field_index = list(STRUCT._names).index(name)
             except ValueError:
-                raise AttributeError, name
-            FIELD_TYPE = STRUCT._flds[name]
-            offset = self._nth_offset(field_index)
-            return self._read(FIELD_TYPE, offset)
+                pass
+            else:
+                FIELD_TYPE = STRUCT._flds[name]
+                offset = self._nth_offset(field_index)
+                return self._read(FIELD_TYPE, offset)
+        if isinstance(self._TYPE.TO, ContainerType):
+            adtmeth = self._TYPE.TO._adtmeths.get(name)
+            if adtmeth is not None:
+                return adtmeth.__get__(self)
         raise AttributeError, name
 
     def __len__(self):

Modified: pypy/dist/pypy/translator/c/test/test_symboltable.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_symboltable.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_symboltable.py	Wed Oct 26 04:23:01 2005
@@ -15,7 +15,8 @@
 
     symtable = getsymboltable(f.__module__)
     debug_list = symtable[addr]
-    assert len(debug_list.items) == 3
-    assert debug_list.items[0] == 4
-    assert debug_list.items[1] == 5
-    assert debug_list.items[2] == 6
+    debug_items = debug_list.ll_items()
+    assert len(debug_items) == 3
+    assert debug_items[0] == 4
+    assert debug_items[1] == 5
+    assert debug_items[2] == 6

Modified: pypy/dist/pypy/translator/goal/targetrpystonex.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetrpystonex.py	(original)
+++ pypy/dist/pypy/translator/goal/targetrpystonex.py	Wed Oct 26 04:23:01 2005
@@ -56,16 +56,18 @@
 
 
 def compare_array_of_array(array, pylist):
-    assert len(array.items) == len(pylist)
+    items = array.ll_items()
+    assert len(items) == len(pylist)
     for i in range(len(pylist)):
-        x1 = array.items[i]
+        x1 = items[i]
         x2 = pylist[i]
         compare_array(x1, x2)
 
 def compare_array(array, pylist):
-    assert len(array.items) == len(pylist)
+    items = array.ll_items()
+    assert len(items) == len(pylist)
     for i in range(len(pylist)):
-        x1 = array.items[i]
+        x1 = items[i]
         x2 = pylist[i]
         assert x1 == x2
 



More information about the Pypy-commit mailing list