[pypy-svn] r77352 - in pypy/branch/fast-forward/pypy/interpreter/astcompiler: . test

afa at codespeak.net afa at codespeak.net
Fri Sep 24 18:07:57 CEST 2010


Author: afa
Date: Fri Sep 24 18:07:55 2010
New Revision: 77352

Modified:
   pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py
   pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_compiler.py
Log:
"a, b += 3" now raises a SyntaxError instead of crashing


Modified: pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py	(original)
+++ pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py	Fri Sep 24 18:07:55 2010
@@ -379,7 +379,7 @@
             self.emit_op(self._op_for_augassign(assign.op))
             self.name_op(target.id, ast.Store)
         else:
-            raise AssertionError("unknown augassign")
+            self.error("illegal expression for augmented assignment", assign)
 
     def visit_Assert(self, asrt):
         self.update_position(asrt.lineno)

Modified: pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_compiler.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_compiler.py	(original)
+++ pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_compiler.py	Fri Sep 24 18:07:55 2010
@@ -704,6 +704,10 @@
         source = "call(a, b, c) = 3"
         py.test.raises(SyntaxError, self.simple_test, source, None, None)
 
+    def test_augassig_to_sequence(self):
+        source = "a, b += 3"
+        py.test.raises(SyntaxError, self.simple_test, source, None, None)
+
     def test_broken_setups(self):
         source = """if 1:
         try:



More information about the Pypy-commit mailing list