[Python-checkins] cpython (3.2): Issue #14965: Fix missing support for starred assignments in

mark.dickinson python-checkins at python.org
Sun May 6 18:35:44 CEST 2012


http://hg.python.org/cpython/rev/c80576303892
changeset:   76802:c80576303892
branch:      3.2
parent:      76796:d5b7be0629c0
user:        Mark Dickinson <mdickinson at enthought.com>
date:        Sun May 06 17:27:39 2012 +0100
summary:
  Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.

files:
  Misc/NEWS                    |  6 ++++++
  Tools/parser/test_unparse.py |  7 +++++++
  Tools/parser/unparse.py      |  4 ++++
  3 files changed, 17 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -225,6 +225,12 @@
 
 - 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?
 ===============================================
diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py
--- a/Tools/parser/test_unparse.py
+++ b/Tools/parser/test_unparse.py
@@ -209,6 +209,13 @@
     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."""
 
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py
--- a/Tools/parser/unparse.py
+++ b/Tools/parser/unparse.py
@@ -472,6 +472,10 @@
         self.dispatch(t.slice)
         self.write("]")
 
+    def _Starred(self, t):
+        self.write("*")
+        self.dispatch(t.value)
+
     # slice
     def _Ellipsis(self, t):
         self.write("...")

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list