summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-18 21:57:45 (GMT)
committerGitHub <noreply@github.com>2022-07-18 21:57:45 (GMT)
commit7733aa048e74a7caee9afed9be95d070c432f7e9 (patch)
treec33d564e6da64d79c7720c723439d8cfe6a00d68 /Grammar
parentbe84daf52aec7b963a743d0c2d66dbd175810803 (diff)
downloadcpython-7733aa048e74a7caee9afed9be95d070c432f7e9.zip
cpython-7733aa048e74a7caee9afed9be95d070c432f7e9.tar.gz
cpython-7733aa048e74a7caee9afed9be95d070c432f7e9.tar.bz2
gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version (GH-94950)
* gh-94949: Disallow parsing parenthesised ctx manager with old feature_version * 📜🤖 Added by blurb_it. * Allow it with feature_version=(3, 9) as well Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 0daba822212cd5d6c63384a27f390f0945330c2b) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram2
1 files changed, 1 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 6a8bb94..6a81e14 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -391,7 +391,7 @@ for_stmt[stmt_ty]:
with_stmt[stmt_ty]:
| invalid_with_stmt_indent
| 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
- _PyAST_With(a, b, NULL, EXTRA) }
+ CHECK_VERSION(stmt_ty, 9, "Parenthesized context managers are", _PyAST_With(a, b, NULL, EXTRA)) }
| 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
_PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
| ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {