mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-129858: Special syntax error for elif
block after else
(#129902)
This commit is contained in:
parent
c3a7118065
commit
99b71efe8e
5 changed files with 137 additions and 75 deletions
|
@ -1422,6 +1422,7 @@ invalid_elif_stmt:
|
|||
invalid_else_stmt:
|
||||
| a='else' ':' NEWLINE !INDENT {
|
||||
RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
|
||||
| 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("'elif' block follows an 'else' block")}
|
||||
invalid_while_stmt:
|
||||
| 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
|
||||
| a='while' named_expression ':' NEWLINE !INDENT {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue