mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-133194: Add CHECK_VERSION to new PEP758 grammar (#133195)
This commit is contained in:
parent
44e4c479fb
commit
b1f893875b
4 changed files with 36 additions and 4 deletions
|
|
@ -442,7 +442,11 @@ try_stmt[stmt_ty]:
|
|||
except_block[excepthandler_ty]:
|
||||
| invalid_except_stmt_indent
|
||||
| 'except' e=expressions ':' b=block {
|
||||
_PyAST_ExceptHandler(e, NULL, b, EXTRA) }
|
||||
CHECK_VERSION(
|
||||
excepthandler_ty,
|
||||
14,
|
||||
"except expressions without parentheses",
|
||||
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
|
||||
| 'except' e=expression 'as' t=NAME ':' b=block {
|
||||
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
|
||||
| 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
|
||||
|
|
@ -450,7 +454,11 @@ except_block[excepthandler_ty]:
|
|||
except_star_block[excepthandler_ty]:
|
||||
| invalid_except_star_stmt_indent
|
||||
| 'except' '*' e=expressions ':' b=block {
|
||||
_PyAST_ExceptHandler(e, NULL, b, EXTRA) }
|
||||
CHECK_VERSION(
|
||||
excepthandler_ty,
|
||||
14,
|
||||
"except expressions without parentheses",
|
||||
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
|
||||
| 'except' '*' e=expression 'as' t=NAME ':' b=block {
|
||||
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
|
||||
| invalid_except_star_stmt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue