Add support for Python 3.8 star expressions in yield statement

This commit is contained in:
David Strobach 2020-08-26 20:31:30 +02:00
parent fb664b3456
commit 5d64139b8f
2 changed files with 16 additions and 0 deletions

View file

@ -1560,6 +1560,14 @@ def test_yield_x_y():
check_stmts("yield x, y", False)
@pytest.mark.skipif(
VER_MAJOR_MINOR < (3, 8),
reason="Python 3.8 feature"
)
def test_return_x_starexpr():
check_stmts("yield x, *[y, z]", False)
def test_yield_from_x():
check_stmts("yield from x", False)

View file

@ -429,3 +429,11 @@ class Parser(ThreeSixParser):
lineno=p1.lineno,
col_offset=p1.lexpos,
)
def p_yield_arg_testlist(self, p):
# remove pre 3.8 grammar
pass
def p_yield_arg_testlist_star_expr(self, p):
"""yield_arg : testlist_star_expr"""
p[0] = {"from": False, "val": p[1][0]}