summaryrefslogtreecommitdiffstats
path: root/Grammar/python.gram
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-18 09:46:21 (GMT)
committerGitHub <noreply@github.com>2022-07-18 09:46:21 (GMT)
commit7dc236d11642a2b366a7f20bc057c1934b3687ef (patch)
treed9007ca5cd6361685e4b0e92e3dd3837945cc28f /Grammar/python.gram
parent30412d91b6bfb4c973dbfd5cbe2c2e2f7d9e0563 (diff)
downloadcpython-7dc236d11642a2b366a7f20bc057c1934b3687ef.zip
cpython-7dc236d11642a2b366a7f20bc057c1934b3687ef.tar.gz
cpython-7dc236d11642a2b366a7f20bc057c1934b3687ef.tar.bz2
gh-94947: Disallow parsing walrus with feature_version < (3, 8) (GH-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> (cherry picked from commit ae0be5a53bb4caee3de4888341addd9c94133f2d) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diffstat (limited to 'Grammar/python.gram')
-rw-r--r--Grammar/python.gram4
1 files changed, 3 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 91d73a9..6a8bb94 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