This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect line number for syntax error.
Type: behavior Stage: needs patch
Components: Parser Versions: Python 3.10
process
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 2022-04-11 14:59 by admin. 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 https://github.com/python/cpython/pull/25729
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88222
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