summaryrefslogtreecommitdiff
path: root/Tools/parser
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-05-06 17:27:39 +0100
committerMark Dickinson <mdickinson@enthought.com>2012-05-06 17:27:39 +0100
commitb51161e66212eec83a8488f0245ac9c6ea144544 (patch)
tree071baec6749906bc81010e9fb9e820c5862b204b /Tools/parser
parent0c5d600996f82288810af3dea6b33f257e47b33a (diff)
downloadcpython-b51161e66212eec83a8488f0245ac9c6ea144544.tar.gz
Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.
Diffstat (limited to 'Tools/parser')
-rw-r--r--Tools/parser/test_unparse.py7
-rw-r--r--Tools/parser/unparse.py4
2 files changed, 11 insertions, 0 deletions
diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py
index d457523b7c..2ac1ea670f 100644
--- a/Tools/parser/test_unparse.py
+++ b/Tools/parser/test_unparse.py
@@ -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."""
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py
index e96ef5477b..d9fca975c5 100644
--- a/Tools/parser/unparse.py
+++ b/Tools/parser/unparse.py
@@ -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("...")