Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.
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 @@
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 @@
self.dispatch(t.slice)
self.write("]")
+ def _Starred(self, t):
+ self.write("*")
+ self.dispatch(t.value)
+
# slice
def _Ellipsis(self, t):
self.write("...")