BPO | [47085](https://bugs.python.org/issue47085) --- | :--- Nosy | @nedbat, @markshannon, @graingert *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = created_at = labels = ['invalid', '3.10', '3.11'] title = 'missing frame.f_lineno on JUMP_ABSOLUTE' updated_at = user = 'https://github.com/graingert' ``` bugs.python.org fields: ```python activity = actor = 'Mark.Shannon' assignee = 'none' closed = True closed_date = closer = 'Mark.Shannon' components = [] creation = creator = 'graingert' dependencies = [] files = [] hgrepos = [] issue_num = 47085 keywords = [] message_count = 2.0 messages = ['415697', '415759'] nosy_count = 3.0 nosy_names = ['nedbat', 'Mark.Shannon', 'graingert'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = 'resolved' status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue47085' versions = ['Python 3.10', 'Python 3.11'] ```
Activity
graingert commentedon Mar 21, 2022
the following code prints:
7 0 LOAD_GLOBAL 0 (range)
2 LOAD_CONST 1 (1)
4 CALL_FUNCTION 1
6 GET_ITER
>> 8 FOR_ITER 7 (to 24)
10 STORE_FAST 0 (i)
8 12 LOAD_FAST 0 (i)
14 LOAD_CONST 2 (0)
16 COMPARE_OP 5 (>=)
18 POP_JUMP_IF_FALSE 11 (to 22)
9 20 NOP
>> 22 JUMP_ABSOLUTE 4 (to 8)
7 >> 24 LOAD_CONST 0 (None)
26 RETURN_VALUE
[(6, -1, 'call'),
(7, 0, 'line'),
(7, 0, 'opcode'),
(7, 2, 'opcode'),
(7, 4, 'opcode'),
(7, 6, 'opcode'),
(7, 8, 'opcode'),
(7, 10, 'opcode'),
(8, 12, 'line'),
(8, 12, 'opcode'),
(8, 14, 'opcode'),
(8, 16, 'opcode'),
(8, 18, 'opcode'),
(9, 20, 'line'),
(9, 20, 'opcode'),
(None, 22, 'opcode'),
(7, 8, 'line'),
(7, 8, 'opcode'),
(7, 24, 'opcode'),
(7, 26, 'opcode'),
(7, 26, 'return')]
but I'd expect (9, 22, 'opcode') instead of (None, 22, 'opcode'),
markshannon commentedon Mar 22, 2022
The
JUMP_ABSOLUTEdoesn't have a line number, as it doesn't correspond to any source.The jump back to the top could follow either the `if i >= 0:` or the `pass`, so cannot have a line number.
Don't expect every bytecode to map directly back to the source, especially if it cannot raise an exception.
Per-line tracing is well defined by PEP-626. Per-opcode tracing is not.
graingert commentedon Jul 19, 2022
looks like this was fixed by ddc4a78 #93229