mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)
This commit is contained in:
parent
f7cc7d296c
commit
7239da7559
6 changed files with 214 additions and 163 deletions
3
Python/generated_cases.c.h
generated
3
Python/generated_cases.c.h
generated
|
|
@ -4809,8 +4809,9 @@
|
|||
if (tstate->tracing) {
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
original_opcode = code->_co_monitoring->lines[(int)(this_instr - _PyFrame_GetBytecode(frame))].original_opcode;
|
||||
int index = (int)(this_instr - _PyFrame_GetBytecode(frame));
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
original_opcode = code->_co_monitoring->lines->data[index*code->_co_monitoring->lines->bytes_per_entry];
|
||||
next_instr = this_instr;
|
||||
} else {
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue