Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ typedef struct {
Line instrumentation creates an array of
these. One entry per code unit.*/
typedef struct {
uint8_t original_opcode;
int8_t line_delta;
uint8_t bytes_per_entry;
uint8_t data[1];
} _PyCoLineInstrumentationData;


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The time to handle a ``LINE`` event in sys.monitoring (and sys.settrace) is
now independent of the number of lines in the code object.
3 changes: 3 additions & 0 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,9 @@ PyCode_Addr2Line(PyCodeObject *co, int addrq)
if (addrq < 0) {
return co->co_firstlineno;
}
if (co->_co_monitoring && co->_co_monitoring->lines) {
return _Py_Instrumentation_GetLine(co, addrq/sizeof(_Py_CODEUNIT));
}
assert(addrq >= 0 && addrq < _PyCode_NBYTES(co));
PyCodeAddressRange bounds;
_PyCode_InitAddressRange(co, &bounds);
Expand Down
3 changes: 2 additions & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4731,7 +4731,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(
Expand Down
3 changes: 2 additions & 1 deletion Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading