[pypy-svn] r14999 - pypy/dist/pypy/interpreter/astcompiler

adim at codespeak.net adim at codespeak.net
Mon Jul 25 12:12:12 CEST 2005


Author: adim
Date: Mon Jul 25 12:12:09 2005
New Revision: 14999

Modified:
   pypy/dist/pypy/interpreter/astcompiler/ast.py
   pypy/dist/pypy/interpreter/astcompiler/transformer.py
Log:
- ast.List's constructor uses an empty list instead of an empty tuple
  to make things homogeneous
- fixed a bug in ast.Node comparison



Modified: pypy/dist/pypy/interpreter/astcompiler/ast.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/ast.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/ast.py	Mon Jul 25 12:12:09 2005
@@ -36,7 +36,11 @@
     def __eq__(self, right):
         if type(self)!=type(right):
             return False
-        for i,j in zip(self.getChildren(),right.getChildren()):
+        self_child = self.getChildren()
+        right_child = right.getChildren()
+        if len(self_child) != len(right_child):
+            return False
+        for i,j in zip(self_child, right_child):
             if not i==j:
                 return False
         return True
@@ -977,6 +981,7 @@
     def accept(self, visitor, args):
         return visitor.visitListComp(self, args)
 
+
 class ListCompFor(Node):
     def __init__(self, assign, list, ifs, lineno=None):
         self.assign = assign

Modified: pypy/dist/pypy/interpreter/astcompiler/transformer.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/transformer.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/transformer.py	Mon Jul 25 12:12:09 2005
@@ -703,7 +703,7 @@
 
     def atom_lsqb(self, nodelist):
         if nodelist[1][0] == token.RSQB:
-            return List(())
+            return List([])
         return self.com_list_constructor(nodelist[1])
 
     def atom_lbrace(self, nodelist):



More information about the Pypy-commit mailing list