summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-05-06 16:27:39 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-05-06 16:27:39 (GMT)
commit1b2e9444fe9eeaef971d498445ebad7fce27f0b9 (patch)
treefe61be4812ea477a37a8a9b5868c61242479c989 /Tools
parent9ab3fdd8cbd12a11eeef7bd8e088e4a7717e0eb3 (diff)
downloadcpython-1b2e9444fe9eeaef971d498445ebad7fce27f0b9.zip
cpython-1b2e9444fe9eeaef971d498445ebad7fce27f0b9.tar.gz
cpython-1b2e9444fe9eeaef971d498445ebad7fce27f0b9.tar.bz2
Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.
Diffstat (limited to 'Tools')
-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 d457523..2ac1ea6 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 e96ef54..d9fca97 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("...")