diff options
author | Tomas R <tomas.roun8@gmail.com> | 2023-10-31 21:02:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 21:02:42 (GMT) |
commit | 453e96e3020d38cfcaebf82b24cb681c6384fa82 (patch) | |
tree | b6b2cd480808d77e219d6aec46d9a6e055720b4b /Grammar | |
parent | faa5f6053d7334a3ecc513c64947ac026439c03a (diff) | |
download | cpython-453e96e3020d38cfcaebf82b24cb681c6384fa82.zip cpython-453e96e3020d38cfcaebf82b24cb681c6384fa82.tar.gz cpython-453e96e3020d38cfcaebf82b24cb681c6384fa82.tar.bz2 |
gh-111420: Allow type comments in parenthesized `with` statements (#111468)
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index ec964d6..55930b0 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -391,8 +391,8 @@ for_stmt[stmt_ty]: with_stmt[stmt_ty]: | invalid_with_stmt_indent - | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block { - 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 { + CHECK_VERSION(stmt_ty, 9, "Parenthesized context managers are", _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), 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 { |