aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2022-07-18 02:20:12 -0700
committerGitHub <noreply@github.com>2022-07-18 10:20:12 +0100
commitae0be5a53bb4caee3de4888341addd9c94133f2d (patch)
treeb6dbf5b251e3ef14eeb30da142e14fa22dbebb60 /Grammar
parentgh-94847: Don't force inlining in debug builds of libmpdec (GH-94848) (diff)
downloadcpython-ae0be5a53bb4caee3de4888341addd9c94133f2d.tar.gz
cpython-ae0be5a53bb4caee3de4888341addd9c94133f2d.tar.bz2
cpython-ae0be5a53bb4caee3de4888341addd9c94133f2d.zip
gh-94947: Disallow parsing walrus with feature_version < (3, 8) (#94948)
* gh-94947: Disallow parsing walrus with feature_version < (3, 8) * oops, commit the parser * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram4
1 files changed, 3 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 91d73a9fffd..6a8bb942fff 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -660,7 +660,9 @@ star_named_expression[expr_ty]:
| named_expression
assignment_expression[expr_ty]:
- | a=NAME ':=' ~ b=expression { _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, EXTRA) }
+ | a=NAME ':=' ~ b=expression {
+ CHECK_VERSION(expr_ty, 8, "Assignment expressions are",
+ _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, EXTRA)) }
named_expression[expr_ty]:
| assignment_expression