From: Mark Dickinson Date: Sun, 6 May 2012 16:27:39 +0000 (+0100) Subject: Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py. X-Git-Tag: v3.3.0a4~249^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b2e9444fe9eeaef971d498445ebad7fce27f0b9;p=thirdparty%2FPython%2Fcpython.git Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py. --- diff --git a/Misc/NEWS b/Misc/NEWS index c63a06dd12d6..37f2209d939b 100644 --- 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? =============================================== diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py index d457523b7c2d..2ac1ea670fe7 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 e96ef5477b87..d9fca975c589 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("...")