[New-bugs-announce] [issue45759] `elif` inside `if` block is a `SyntaxError`

theeshallnotknowethme report at bugs.python.org
Mon Nov 8 18:51:38 EST 2021


New submission from theeshallnotknowethme <nohackingofkrowten at gmail.com>:

While fixing errors in a program, I encountered this:

if a == b + 2:
    c = sqrt(b) + a**2
    elif a == b + 3:
    ^^^^
SyntaxError: Invalid syntax

It should be giving an `IndentationError` or a better error message at least.

----------
components: Parser
messages: 405990
nosy: February291948, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: `elif` inside `if` block is a `SyntaxError`
type: behavior
versions: Python 3.10, Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45759>
_______________________________________


More information about the New-bugs-announce mailing list