gh-133194: Add CHECK_VERSION to new PEP758 grammar (#133195)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user