]> granicus.if.org Git - python/commitdiff
Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.
authorMark Dickinson <mdickinson@enthought.com>
Sun, 6 May 2012 16:27:39 +0000 (17:27 +0100)
committerMark Dickinson <mdickinson@enthought.com>
Sun, 6 May 2012 16:27:39 +0000 (17:27 +0100)
Misc/NEWS
Tools/parser/test_unparse.py
Tools/parser/unparse.py

index c63a06dd12d69339f8b95ad6a391d06dd89a4d1a..37f2209d939b764cae45455c49a45dd7ca8581e9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -225,6 +225,12 @@ Documentation
 
 - Issue #14034: added the argparse tutorial.
 
+Tools/Demos
+-----------
+
+- Issue #14965: Fix missing support for starred assignments in
+  Tools/parser/unparse.py.
+
 
 What's New in Python 3.2.3 release candidate 2?
 ===============================================
index d457523b7c2d13f9970c975aba30e42ece8409e2..2ac1ea670fe79e552d9c0aad6fdbf3e723e1bf7d 100644 (file)
@@ -209,6 +209,13 @@ class UnparseTestCase(ASTTestCase):
     def test_try_except_finally(self):
         self.check_roundtrip(try_except_finally)
 
+    def test_starred_assignment(self):
+        self.check_roundtrip("a, *b, c = seq")
+        self.check_roundtrip("a, (*b, c) = seq")
+        self.check_roundtrip("a, *b[0], c = seq")
+        self.check_roundtrip("a, *(b, c) = seq")
+
+
 class DirectoryTestCase(ASTTestCase):
     """Test roundtrip behaviour on all files in Lib and Lib/test."""
 
index e96ef5477b872ae9e11b83ef95e4da71761ed5d7..d9fca975c589c3da7a6788588f150bf18f5a6e86 100644 (file)
@@ -472,6 +472,10 @@ class Unparser:
         self.dispatch(t.slice)
         self.write("]")
 
+    def _Starred(self, t):
+        self.write("*")
+        self.dispatch(t.value)
+
     # slice
     def _Ellipsis(self, t):
         self.write("...")