mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.14] gh-133999: Fix except
parsing regression in 3.14 (GH-134035) (#134206)
gh-133999: Fix `except` parsing regression in 3.14 (GH-134035)
(cherry picked from commit 84914ad0e5
)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
9136ccfffe
commit
d9c08c57e9
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