Author: Benjamin Peterson <[email protected]>
Branch: py3k
Changeset: r53637:6d65571469dc
Date: 2012-03-14 20:45 -0500
http://bitbucket.org/pypy/pypy/changeset/6d65571469dc/

Log:    allow extended unpacking as loop targets

diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py 
b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -843,6 +843,11 @@
             return a
         """
         yield self.st, func, "f()", [1, 2, 3]
+        func = """def f():
+            for a, *b, c in [(1, 2, 3, 4)]:
+                return a, b, c
+        """
+        yield self.st, func, "f()", (1, [2, 3], 4)
         py.test.raises(SyntaxError, self.simple_test, "*a, *b = [1, 2]",
                        None, None)
         py.test.raises(SyntaxError, self.simple_test, "a = [*b, c]",
diff --git a/pypy/interpreter/pyparser/data/Grammar3.2 
b/pypy/interpreter/pyparser/data/Grammar3.2
--- a/pypy/interpreter/pyparser/data/Grammar3.2
+++ b/pypy/interpreter/pyparser/data/Grammar3.2
@@ -114,7 +114,7 @@
 subscriptlist: subscript (',' subscript)* [',']
 subscript: test | [test] ':' [test] [sliceop]
 sliceop: ':' [test]
-exprlist: expr (',' expr)* [',']
+exprlist: (expr|star_expr) (',' (expr|star_expr))* [',']
 testlist: test (',' test)* [',']
 dictmaker: test ':' test (',' test ':' test)* [',']
 dictorsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to