summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorDavid Cuthbert <dacut@kanga.org>2018-09-22 01:31:15 (GMT)
committerGuido van Rossum <guido@python.org>2018-09-22 01:31:15 (GMT)
commitfd97d1f1af910a6222ea12aec42c456b64f9aee4 (patch)
treee07d238eb81a7f526e40249b706d95b4ba4a4748 /Grammar
parent7279b5125e7c5d84a473d250b27d353cb7f6628e (diff)
downloadcpython-fd97d1f1af910a6222ea12aec42c456b64f9aee4.zip
cpython-fd97d1f1af910a6222ea12aec42c456b64f9aee4.tar.gz
cpython-fd97d1f1af910a6222ea12aec42c456b64f9aee4.tar.bz2
bpo-32117: Allow tuple unpacking in return and yield statements (gh-4509)
Iterable unpacking is now allowed without parentheses in yield and return statements, e.g. ``yield 1, 2, 3, *rest``. Thanks to David Cuthbert for the change and jChapman for added tests.
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar4
1 files changed, 2 insertions, 2 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 7d3dd0b..e232df9 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -50,7 +50,7 @@ pass_stmt: 'pass'
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
break_stmt: 'break'
continue_stmt: 'continue'
-return_stmt: 'return' [testlist]
+return_stmt: 'return' [testlist_star_expr]
yield_stmt: yield_expr
raise_stmt: 'raise' [test ['from' test]]
import_stmt: import_name | import_from
@@ -147,4 +147,4 @@ comp_if: 'if' test_nocond [comp_iter]
encoding_decl: NAME
yield_expr: 'yield' [yield_arg]
-yield_arg: 'from' test | testlist
+yield_arg: 'from' test | testlist_star_expr