mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-133999: Fix except
parsing regression in 3.14 (#134035)
This commit is contained in:
parent
7a9d46295a
commit
84914ad0e5
4 changed files with 43 additions and 12 deletions
|
@ -1418,7 +1418,7 @@ invalid_except_stmt:
|
|||
RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized when using 'as'") }
|
||||
| a='except' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
|
||||
| a='except' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
|
||||
| 'except' expression 'as' a=expression {
|
||||
| 'except' expression 'as' a=expression ':' block {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
|
||||
a, "cannot use except statement with %s", _PyPegen_get_expr_name(a)) }
|
||||
invalid_except_star_stmt:
|
||||
|
@ -1426,7 +1426,7 @@ invalid_except_star_stmt:
|
|||
RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized when using 'as'") }
|
||||
| a='except' '*' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
|
||||
| a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR("expected one or more exception types") }
|
||||
| 'except' '*' expression 'as' a=expression {
|
||||
| 'except' '*' expression 'as' a=expression ':' block {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
|
||||
a, "cannot use except* statement with %s", _PyPegen_get_expr_name(a)) }
|
||||
invalid_finally_stmt:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue