Repository navigation
sys.monitoring: BRANCH_LEFT event from a non-branch opcode #128419
Copy link
Copy link
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jan 2, 2025 - addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Jan 2, 2025 That does look like a compiler issue. Once #128445 is in, we can probably move adding
NOT_TAKENto the assembler which should fix this.I think this is fixed now.
This is the disassembly I get on main:0 0 RESUME 0 2 2 LOAD_CONST 0 ((1, 0)) 4 UNPACK_SEQUENCE 2 8 STORE_NAME 0 (a) 10 STORE_NAME 1 (i) 3 L1: 12 NOP 4 14 LOAD_NAME 1 (i) 16 LOAD_SMALL_INT 3 18 COMPARE_OP 188 (bool(>=)) 22 POP_JUMP_IF_FALSE 4 (to L2) 26 NOT_TAKEN 5 28 LOAD_SMALL_INT 4 30 STORE_NAME 0 (a) 6 32 JUMP_FORWARD 11 (to L3) 7 L2: 34 LOAD_NAME 1 (i) 36 LOAD_SMALL_INT 1 38 BINARY_OP 13 (+=) 50 STORE_NAME 1 (i) 52 JUMP_BACKWARD 22 (to L1) 8 L3: 56 LOAD_NAME 0 (a) 58 LOAD_SMALL_INT 4 60 COMPARE_OP 88 (bool(==)) 64 POP_JUMP_IF_FALSE 8 (to L4) 68 NOT_TAKEN 70 LOAD_NAME 1 (i) 72 LOAD_SMALL_INT 3 74 COMPARE_OP 88 (bool(==)) 78 POP_JUMP_IF_TRUE 3 (to L5) 82 NOT_TAKEN L4: 84 LOAD_COMMON_CONSTANT 0 (AssertionError) 86 RAISE_VARARGS 1 L5: 88 LOAD_CONST 1 (None) 90 RETURN_VALUE
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
Using sys.monitoring, I get a BRANCH_LEFT event from an instruction with no branch (STORE_NAME).
This is while_true.py:
Disassembled:
Running run_sysmon.py shows these events:
The starred line is a BRANCH_LEFT event from a STORE_NAME opcode, which doesn't make sense. The disassembly shows line 2 with a NOT_TAKEN event which I expect is left over from optimizing away the
while True:.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS