Skip to content

Commit 3e8d85e

Browse files
committed
Use _PyInterpreterState_SetEvalFrameFunc when setting / clearing perf trampoline
1 parent d8a67c2 commit 3e8d85e

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

Python/perf_trampoline.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,6 @@ _PyPerfTrampoline_SetCallbacks(_PyPerf_Callbacks *callbacks)
471471
return 0;
472472
}
473473

474-
#ifdef PY_HAVE_PERF_TRAMPOLINE
475-
static void
476-
set_eval_frame(PyThreadState *tstate, _PyFrameEvalFunction eval_frame)
477-
{
478-
_PyEval_StopTheWorld(tstate->interp);
479-
tstate->interp->eval_frame = eval_frame;
480-
_PyEval_StartTheWorld(tstate->interp);
481-
}
482-
#endif
483-
484474
int
485475
_PyPerfTrampoline_Init(int activate)
486476
{
@@ -494,11 +484,11 @@ _PyPerfTrampoline_Init(int activate)
494484
return -1;
495485
}
496486
if (!activate) {
497-
set_eval_frame(tstate, NULL);
487+
_PyInterpreterState_SetEvalFrameFunc(tstate->interp, NULL);
498488
perf_status = PERF_STATUS_NO_INIT;
499489
}
500490
else {
501-
set_eval_frame(tstate, py_trampoline_evaluator);
491+
_PyInterpreterState_SetEvalFrameFunc(tstate->interp, py_trampoline_evaluator);
502492
if (new_code_arena() < 0) {
503493
return -1;
504494
}
@@ -524,7 +514,7 @@ _PyPerfTrampoline_Fini(void)
524514
}
525515
PyThreadState *tstate = _PyThreadState_GET();
526516
if (tstate->interp->eval_frame == py_trampoline_evaluator) {
527-
set_eval_frame(tstate, NULL);
517+
_PyInterpreterState_SetEvalFrameFunc(tstate->interp, NULL);
528518
}
529519
if (perf_status == PERF_STATUS_OK) {
530520
trampoline_api.free_state(trampoline_api.state);

0 commit comments

Comments
 (0)