Title: Incorrect line number for syntax error.
Type: behavior Stage: needs patch
Components: Parser Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Mark.Shannon Nosy List: Mark.Shannon, lys.nikolaou, pablogsal
Priority: release blocker Keywords: patch

Created on 2021-05-06 11:31 by Mark.Shannon, last changed 2021-05-07 13:58 by Mark.Shannon. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25939 merged Mark.Shannon, 2021-05-06 11:45
Messages (1)
msg393083 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-05-06 11:31
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
Date User Action Args
2021-05-07 13:58:20Mark.Shannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> needs patch
2021-05-06 11:45:24Mark.Shannonsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request24606
2021-05-06 11:31:28Mark.Shannoncreate