diff options
author | Mark Shannon <mark@hotpy.org> | 2025-01-21 09:33:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-21 09:33:23 +0000 |
commit | 7239da75592081b6e8d0917a2cd2bf19907c8165 (patch) | |
tree | f7736a473d3889513a4b0a31ad543d177808de40 /Python/bytecodes.c | |
parent | f7cc7d296c2cbb33d3f0bde4ace82e8569f7dbc3 (diff) | |
download | cpython-7239da75592081b6e8d0917a2cd2bf19907c8165.tar.gz cpython-7239da75592081b6e8d0917a2cd2bf19907c8165.zip |
GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 398f1d564fa..b2745c3400f 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -4816,7 +4816,8 @@ dummy_func( int original_opcode = 0; if (tstate->tracing) { PyCodeObject *code = _PyFrame_GetCode(frame); - original_opcode = code->_co_monitoring->lines[(int)(this_instr - _PyFrame_GetBytecode(frame))].original_opcode; + int index = (int)(this_instr - _PyFrame_GetBytecode(frame)); + original_opcode = code->_co_monitoring->lines->data[index*code->_co_monitoring->lines->bytes_per_entry]; next_instr = this_instr; } else { original_opcode = _Py_call_instrumentation_line( |