mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
gh-103615: Use local events for opcode tracing (GH-109472)
* Use local monitoring for opcode trace * Remove f_opcode_trace_set * Add test for setting f_trace_opcodes after settrace
This commit is contained in:
parent
2bc01cc0c7
commit
e0afed7e27
9 changed files with 114 additions and 8 deletions
|
|
@ -127,10 +127,13 @@ frame_settrace_opcodes(PyFrameObject *f, PyObject* value, void *Py_UNUSED(ignore
|
|||
}
|
||||
if (value == Py_True) {
|
||||
f->f_trace_opcodes = 1;
|
||||
_PyInterpreterState_GET()->f_opcode_trace_set = true;
|
||||
if (f->f_trace) {
|
||||
return _PyEval_SetOpcodeTrace(f, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
f->f_trace_opcodes = 0;
|
||||
return _PyEval_SetOpcodeTrace(f, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -842,6 +845,9 @@ frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
|
|||
}
|
||||
if (v != f->f_trace) {
|
||||
Py_XSETREF(f->f_trace, Py_XNewRef(v));
|
||||
if (v != NULL && f->f_trace_opcodes) {
|
||||
return _PyEval_SetOpcodeTrace(f, true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue