Skip to content

Commit 03ec62c

Browse files
committed
Changes from review
1 parent a1d8760 commit 03ec62c

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Python/ceval.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,9 +2510,7 @@ PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
25102510
void
25112511
PyEval_SetProfileAllThreads(Py_tracefunc func, PyObject *arg)
25122512
{
2513-
PyThreadState *this_tstate = _PyThreadState_GET();
2514-
PyInterpreterState* interp = this_tstate->interp;
2515-
2513+
PyInterpreterState *interp = _PyInterpreterState_GET();
25162514
if (_PyEval_SetProfileAllThreads(interp, func, arg) < 0) {
25172515
/* Log _PySys_Audit() error */
25182516
PyErr_FormatUnraisable("Exception ignored in PyEval_SetProfileAllThreads");
@@ -2532,9 +2530,7 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
25322530
void
25332531
PyEval_SetTraceAllThreads(Py_tracefunc func, PyObject *arg)
25342532
{
2535-
PyThreadState *this_tstate = _PyThreadState_GET();
2536-
PyInterpreterState* interp = this_tstate->interp;
2537-
2533+
PyInterpreterState *interp = _PyInterpreterState_GET();
25382534
if (_PyEval_SetTraceAllThreads(interp, func, arg) < 0) {
25392535
/* Log _PySys_Audit() error */
25402536
PyErr_FormatUnraisable("Exception ignored in PyEval_SetTraceAllThreads");

Python/instrumentation.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,10 +1946,7 @@ instrument_all_executing_code_objects(PyInterpreterState *interp)
19461946
ASSERT_WORLD_STOPPED();
19471947

19481948
int err = 0;
1949-
_PyRuntimeState *runtime = &_PyRuntime;
1950-
HEAD_LOCK(runtime);
1951-
PyThreadState *ts = PyInterpreterState_ThreadHead(interp);
1952-
while (ts) {
1949+
_Py_FOR_EACH_TSTATE_BEGIN(interp, ts) {
19531950
_PyInterpreterFrame *frame = ts->current_frame;
19541951
while (frame) {
19551952
if (frame->owner < FRAME_OWNED_BY_INTERPRETER) {
@@ -1960,10 +1957,9 @@ instrument_all_executing_code_objects(PyInterpreterState *interp)
19601957
}
19611958
frame = frame->previous;
19621959
}
1963-
ts = PyThreadState_Next(ts);
19641960
}
19651961
done:
1966-
HEAD_UNLOCK(runtime);
1962+
_Py_FOR_EACH_TSTATE_END(interp);
19671963
return err;
19681964
}
19691965

0 commit comments

Comments
 (0)