bpo-38641: Add support of starred expressions in return/yield to lib2to3 by vemel · Pull Request #16994 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/lib2to3/Grammar.txt
14 changes: 13 additions & 1 deletion Lib/lib2to3/tests/data/py3_test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,27 @@ def test_inner(extra_burning_oil = 1, count=0):
test_inner()

def testReturn(self):
# 'return' [testlist]
# 'return' [testlist_star_expr]
def g1(): return
def g2(): return 1
return_list = [2, 3]
def g3(): return 1, *return_list
g1()
x = g2()
x3 = g3()
check_syntax_error(self, "class foo:return 1")

def testYield(self):
# 'yield' [yield_arg]
def g1(): yield 1
yield_list = [2, 3]
def g2(): yield 1, *yield_list
def g3(): yield from iter(yield_list)
Comment thread
pablogsal marked this conversation as resolved.
x1 = g1()
x2 = g2()
x3 = g3()
check_syntax_error(self, "class foo:yield 1")
check_syntax_error(self, "def g4(): yield from *a")

def testRaise(self):
# 'raise' test [',' test]
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1910,5 +1910,6 @@ Jelle Zijlstra
Gennadiy Zlobin
Doug Zongker
Peter Åstrand
Vlad Emelianov
Comment thread
pablogsal marked this conversation as resolved.

(Entries should be added in rough alphabetical order by last names)