[3.11] gh-96587: Raise SyntaxError for PEP654 on older feature_version (GH-96588) (#96591)

(cherry picked from commit 2c7d2e8d46)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Nikita Sobolev 2022-10-06 01:00:13 +03:00 committed by GitHub
parent a8d50aeada
commit 8c6ced36ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View file

@ -412,7 +412,9 @@ try_stmt[stmt_ty]:
| invalid_try_stmt
| 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, EXTRA) }
| 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }
| 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] { _PyAST_TryStar(b, ex, el, f, EXTRA) }
| 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] {
CHECK_VERSION(stmt_ty, 11, "Exception groups are",
_PyAST_TryStar(b, ex, el, f, EXTRA)) }
# Except statement