Skip to content
Prev Previous commit
Next Next commit
Changes from review
  • Loading branch information
colesbury committed Aug 11, 2025
commit 03ec62c2cac784996afbdc2c2180cb8ad9671acd
8 changes: 2 additions & 6 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2510,9 +2510,7 @@ PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
void
PyEval_SetProfileAllThreads(Py_tracefunc func, PyObject *arg)
{
PyThreadState *this_tstate = _PyThreadState_GET();
PyInterpreterState* interp = this_tstate->interp;

PyInterpreterState *interp = _PyInterpreterState_GET();
if (_PyEval_SetProfileAllThreads(interp, func, arg) < 0) {
/* Log _PySys_Audit() error */
PyErr_FormatUnraisable("Exception ignored in PyEval_SetProfileAllThreads");
Expand All @@ -2532,9 +2530,7 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
void
PyEval_SetTraceAllThreads(Py_tracefunc func, PyObject *arg)
{
PyThreadState *this_tstate = _PyThreadState_GET();
PyInterpreterState* interp = this_tstate->interp;

PyInterpreterState *interp = _PyInterpreterState_GET();
if (_PyEval_SetTraceAllThreads(interp, func, arg) < 0) {
/* Log _PySys_Audit() error */
PyErr_FormatUnraisable("Exception ignored in PyEval_SetTraceAllThreads");
Expand Down
8 changes: 2 additions & 6 deletions Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1946,10 +1946,7 @@ instrument_all_executing_code_objects(PyInterpreterState *interp)
ASSERT_WORLD_STOPPED();

int err = 0;
_PyRuntimeState *runtime = &_PyRuntime;
HEAD_LOCK(runtime);
PyThreadState *ts = PyInterpreterState_ThreadHead(interp);
while (ts) {
_Py_FOR_EACH_TSTATE_BEGIN(interp, ts) {
_PyInterpreterFrame *frame = ts->current_frame;
while (frame) {
if (frame->owner < FRAME_OWNED_BY_INTERPRETER) {
Expand All @@ -1960,10 +1957,9 @@ instrument_all_executing_code_objects(PyInterpreterState *interp)
}
frame = frame->previous;
}
ts = PyThreadState_Next(ts);
}
done:
HEAD_UNLOCK(runtime);
_Py_FOR_EACH_TSTATE_END(interp);
return err;
}

Expand Down
Loading