[New-bugs-announce] [issue44056] Incorrect line number for syntax error.

Mark Shannon report at bugs.python.org
Thu May 6 07:31:28 EDT 2021


New submission from Mark Shannon <mark at hotpy.org>:

Consider this function, which has a syntax error on line 4.

>>> def f():
...     try: 
...         1/0
...     except:
...         pass
...     except Exception: 
...         pass

3.9 reports an incorrect line number of 3.
3.10b reports an even more incorrect line number of -1.

Although I've marked this as a "Parser" bug, the offending code is in the compiler.

For 3.11, this is fixed by https://github.com/python/cpython/pull/25729

----------
assignee: Mark.Shannon
components: Parser
messages: 393083
nosy: Mark.Shannon, lys.nikolaou, pablogsal
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Incorrect line number for syntax error.
type: behavior
versions: Python 3.10

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


More information about the New-bugs-announce mailing list