New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

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.

----------
components: Interpreter Core
messages: 364388
nosy: benjamin.peterson, brett.cannon, pablogsal, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Simplify setting line numbers in the compiler
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39987>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to