You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
code.co_positions behaviour does not match documentation #100117
The iterator returns tuples containing the (start_line, end_line, start_column, end_column). The i-th tuple corresponds to the position of the source code that compiled to the i-th instruction.
I think this is incorrect, because the iterator returns tuples for cache entries as well:
Activity
iritkatriel commentedon Dec 8, 2022
CC @markshannon @brandtbucher .
[-]error documentation of code.co_positions[/-][+]error in documentation of code.co_positions[/+][-]error in documentation of code.co_positions[/-][+]code.co_positions behaviour does not match documentation[/+]brandtbucher commentedon Dec 21, 2022
I think this is probably just a place where the docs could be improved.
Are you suggesting replacing "instruction" with "code unit"? Or adding a note that inline
CACHE"instructions" are included? I'd be fine with either.iritkatriel commentedon Dec 22, 2022
We discussed this at the meeting and I think the view was that the implementation needs to change. @markshannon ?
markshannon commentedon Dec 22, 2022
I don't think we can change the current behavior of emitting one tuple per code unit . The docs should reflect that behaviour.
I think it is
co_lines()that we should modify. We can merge successive tuples with the same line number, now that #99556 is merged.GH-100117: Make `co_lines` more efficient (GH-100447)
iritkatriel commentedon Dec 11, 2023
This shouldn't have been closed, the doc is still incorrect.
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
gh-100117: Fix inaccuracy in documentation of the CodeObject's co_pos…
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
[3.12] gh-100117: Fix inaccuracy in documentation of the CodeObject's…
[3.13] gh-100117: Fix inaccuracy in documentation of the CodeObject's…
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
pythongh-100117: Fix inaccuracy in documentation of the CodeObject's …
[3.11] gh-100117: Fix inaccuracy in documentation of the CodeObject's…