Skip to content

Commit 1b2e944

Browse files
committed
Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.
1 parent 9ab3fdd commit 1b2e944

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ Documentation
225225

226226
- Issue #14034: added the argparse tutorial.
227227

228+
Tools/Demos
229+
-----------
230+
231+
- Issue #14965: Fix missing support for starred assignments in
232+
Tools/parser/unparse.py.
233+
228234

229235
What's New in Python 3.2.3 release candidate 2?
230236
===============================================

Tools/parser/test_unparse.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ def test_elifs(self):
209209
def test_try_except_finally(self):
210210
self.check_roundtrip(try_except_finally)
211211

212+
def test_starred_assignment(self):
213+
self.check_roundtrip("a, *b, c = seq")
214+
self.check_roundtrip("a, (*b, c) = seq")
215+
self.check_roundtrip("a, *b[0], c = seq")
216+
self.check_roundtrip("a, *(b, c) = seq")
217+
218+
212219
class DirectoryTestCase(ASTTestCase):
213220
"""Test roundtrip behaviour on all files in Lib and Lib/test."""
214221

Tools/parser/unparse.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ def _Subscript(self, t):
472472
self.dispatch(t.slice)
473473
self.write("]")
474474

475+
def _Starred(self, t):
476+
self.write("*")
477+
self.dispatch(t.value)
478+
475479
# slice
476480
def _Ellipsis(self, t):
477481
self.write("...")

0 commit comments

Comments
 (0)