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: Update dis.findlinestarts documentaiton to reflect new usage of `co_lines` (PEP 626)
Type: Stage:
Components: Documentation Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Mark.Shannon, docs@python, gwk, laike9m
Priority: normal Keywords:

Created on 2021-08-09 22:33 by gwk, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg399290 - (view) Author: George King (gwk) * Date: 2021-08-09 22:33
`dis.findlinestarts()` has been changed to use the no `co_lines()` function. (Blame indicates commit 877df851c3e by Mark Shannon.) However the docs currently state that it uses the older `co_firstlineno` and `co_lnotab`: https://docs.python.org/3.10/library/dis.html#dis.findlinestarts.

My cursory understanding of `dis.py` internals is that `get_instructions` relies on `findlinestarts`, implying that both of these APIs are going to return different line numbers than they did previously. I am perfectly fine with this, and hopeful that the PEP 626 changes will improve tool accuracy.

At minimum the `dis` docs should be updated. I also suggest that some kind of note about this be added to the PEP 626 text, because the way it reads now suggests that it avoids breakage by creating the new `co_lines` API. However it seems that users of the higher level dis APIs are going to see subtly different behavior.

FWIW I am fine with the change, and I hope this doesn't instigate a reversion to the old behavior. `lnotabs` semantics were very cryptic and seemed rather broken when I attempted to use it years ago. I am revisiting an experimental code coverage tool in part because of the PEP.
msg399291 - (view) Author: George King (gwk) * Date: 2021-08-09 22:34
I should also mention that my reading was not exhaustive, so there may be other docs that need updating as well.
msg409647 - (view) Author: laike9m (laike9m) * Date: 2022-01-04 05:24
Agreed. The current doc for `findlinestarts` is outdated.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89038
2022-01-04 05:24:34laike9msetnosy: + laike9m
messages: + msg409647
2021-08-09 22:34:38gwksetmessages: + msg399291
2021-08-09 22:33:48gwkcreate