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: Simplify setting line numbers in the compiler
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, brett.cannon, pablogsal, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2020-03-17 06:54 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19037 merged serhiy.storchaka, 2020-03-17 06:55
Messages (2)
msg364388 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-17 06:54
Currently the compiler can set the line number to the instruction or keep it unset (zero). Then, when create linenotab it adds entries only for set line numbers. But in rare cases (docstring or the first instruction in the module, definition of a function with default arguments, maybe more) it may add multiple entries for the same lineno even if the bytecode offset is less than 255. Seems the only effect of this is a suboptimal linenotab.

The proposed PR simplifies setting the line number in the compiler (it was the primary goal) and also fixes the above minor issue. The simplification is needed for several future changes in the compiler.
msg364441 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-17 16:07
New changeset 61cb3d02b83e746e59bb1351a0865e3b8714b2d6 by Serhiy Storchaka in branch 'master':
bpo-39987: Simplify setting lineno in the compiler. (GH-19037)
https://github.com/python/cpython/commit/61cb3d02b83e746e59bb1351a0865e3b8714b2d6
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84168
2020-03-17 16:08:21serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-17 16:07:34serhiy.storchakasetmessages: + msg364441
2020-03-17 06:55:52serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18388
2020-03-17 06:54:30serhiy.storchakacreate