[pypy-svn] r16462 - in pypy/dist/pypy: interpreter/pyparser interpreter/stablecompiler lib/_stablecompiler

ludal at codespeak.net ludal at codespeak.net
Thu Aug 25 12:51:04 CEST 2005


Author: ludal
Date: Thu Aug 25 12:51:02 2005
New Revision: 16462

Modified:
   pypy/dist/pypy/interpreter/pyparser/astbuilder.py
   pypy/dist/pypy/interpreter/stablecompiler/transformer.py
   pypy/dist/pypy/lib/_stablecompiler/transformer.py
Log:
 - fix test_syntax by setting appropriate error message in case of delete f()
 - updated stablecompiler, _stablecompiler and added TODO to astcompiler


Modified: pypy/dist/pypy/interpreter/pyparser/astbuilder.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/astbuilder.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/astbuilder.py	Thu Aug 25 12:51:02 2005
@@ -318,7 +318,9 @@
         ast_node.flags = flags
         return ast_node
     else:
-        assert False, "TODO"
+        # TODO: check type of ast_node and raise according SyntaxError in case
+        # of del f()
+        raise SyntaxError("cannot assign to %s" % ast_node )
 
 def is_augassign( ast_node ):
     if ( isinstance( ast_node, ast.Name ) or

Modified: pypy/dist/pypy/interpreter/stablecompiler/transformer.py
==============================================================================
--- pypy/dist/pypy/interpreter/stablecompiler/transformer.py	(original)
+++ pypy/dist/pypy/interpreter/stablecompiler/transformer.py	Thu Aug 25 12:51:02 2005
@@ -929,6 +929,7 @@
         l = self.com_node(node)
         if l.__class__ in (Name, Slice, Subscript, Getattr):
             return l
+        print node # XXX
         raise SyntaxError, "can't assign to %s" % l.__class__.__name__
 
     def com_assign(self, node, assigning):
@@ -1001,7 +1002,10 @@
         if t == token.LSQB:
             return self.com_subscriptlist(primary, node[2], assigning)
         if t == token.LPAR:
-            raise SyntaxError, "can't assign to function call"
+            if assigning==OP_DELETE:
+                raise SyntaxError, "can't delete function call"
+            else:
+                raise SyntaxError, "can't assign to function call"
         raise SyntaxError, "unknown trailer type: %s" % t
 
     def com_assign_attr(self, primary, node, assigning):

Modified: pypy/dist/pypy/lib/_stablecompiler/transformer.py
==============================================================================
--- pypy/dist/pypy/lib/_stablecompiler/transformer.py	(original)
+++ pypy/dist/pypy/lib/_stablecompiler/transformer.py	Thu Aug 25 12:51:02 2005
@@ -997,7 +997,10 @@
         if t == token.LSQB:
             return self.com_subscriptlist(primary, node[2], assigning)
         if t == token.LPAR:
-            raise SyntaxError, "can't assign to function call"
+            if assigning==OP_DELETE:
+                raise SyntaxError, "can't delete function call"
+            else:
+                raise SyntaxError, "can't assign to function call"
         raise SyntaxError, "unknown trailer type: %s" % t
 
     def com_assign_attr(self, primary, node, assigning):



More information about the Pypy-commit mailing list