mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
gh-107674: Improve performance of sys.settrace
(GH-117133)
* Check tracing in RESUME_CHECK * Only change to RESUME_CHECK if not tracing
This commit is contained in:
parent
998c3856c1
commit
9c14ed0618
7 changed files with 63 additions and 52 deletions
|
@ -1217,15 +1217,13 @@ int
|
|||
_Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame, _Py_CODEUNIT *instr, _Py_CODEUNIT *prev)
|
||||
{
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
assert(tstate->tracing == 0);
|
||||
assert(is_version_up_to_date(code, tstate->interp));
|
||||
assert(instrumentation_cross_checks(tstate->interp, code));
|
||||
int i = (int)(instr - _PyCode_CODE(code));
|
||||
|
||||
_PyCoMonitoringData *monitoring = code->_co_monitoring;
|
||||
_PyCoLineInstrumentationData *line_data = &monitoring->lines[i];
|
||||
if (tstate->tracing) {
|
||||
goto done;
|
||||
}
|
||||
PyInterpreterState *interp = tstate->interp;
|
||||
int8_t line_delta = line_data->line_delta;
|
||||
int line = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue