← 返回首页
Incorrect line number calculated in traceback · Issue #93662 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Incorrect line number calculated in traceback #93662

New issue
New issue

Description

Consider the following code:

def _run_with_file_output(): example_report_generation_message= ( """ """ ).strip() raise ValueError() _run_with_file_output()

If you execute this with 3.11.0a7 you get (correct traceback):

Traceback (most recent call last): File "/home/pablogsal/github/python/3.11/lel.py", line 8, in <module> _run_with_file_output() ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pablogsal/github/python/3.11/lel.py", line 6, in _run_with_file_output raise ValueError() ^^^^^^^^^^^^^^^^^^ ValueError

but on 3.11.0b1 you get:

Traceback (most recent call last): File "/home/pablogsal/github/python/3.11/lel.py", line 8, in <module> _run_with_file_output() ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pablogsal/github/python/3.11/lel.py", line 255, in _run_with_file_output ValueError

Notice that the last line number for _run_with_file_output is wrong (255 instead of 6).

Bisecting points at:

944fffee8916cb94321fa33cd3a43f4108717746 is the first bad commit commit 944fffee8916cb94321fa33cd3a43f4108717746 Author: Mark Shannon <mark@hotpy.org> Date: Thu Apr 21 16:10:37 2022 +0100 GH-88116: Use a compact format to represent end line and column offsets. (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format

Metadata

Metadata

Assignees

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

  • Open in GitHub Copilot app

Footer

© 2026 GitHub, Inc.