mirror of
https://github.com/python/cpython.git
synced 2026-04-20 10:51:00 +00:00
gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032)
Allow keeping specialization enabled when specifying eval frame function
This commit is contained in:
parent
cecf564073
commit
c0af5c024b
10 changed files with 196 additions and 20 deletions
|
|
@ -3026,9 +3026,32 @@ _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp,
|
|||
RARE_EVENT_INC(set_eval_frame_func);
|
||||
_PyEval_StopTheWorld(interp);
|
||||
interp->eval_frame = eval_frame;
|
||||
// reset when evaluator is reset
|
||||
interp->eval_frame_allow_specialization = 0;
|
||||
_PyEval_StartTheWorld(interp);
|
||||
}
|
||||
|
||||
void
|
||||
_PyInterpreterState_SetEvalFrameAllowSpecialization(PyInterpreterState *interp,
|
||||
int allow_specialization)
|
||||
{
|
||||
if (allow_specialization == interp->eval_frame_allow_specialization) {
|
||||
return;
|
||||
}
|
||||
_Py_Executors_InvalidateAll(interp, 1);
|
||||
RARE_EVENT_INC(set_eval_frame_func);
|
||||
_PyEval_StopTheWorld(interp);
|
||||
interp->eval_frame_allow_specialization = allow_specialization;
|
||||
_PyEval_StartTheWorld(interp);
|
||||
}
|
||||
|
||||
int
|
||||
_PyInterpreterState_IsSpecializationEnabled(PyInterpreterState *interp)
|
||||
{
|
||||
return interp->eval_frame == NULL
|
||||
|| interp->eval_frame_allow_specialization;
|
||||
}
|
||||
|
||||
|
||||
const PyConfig*
|
||||
_PyInterpreterState_GetConfig(PyInterpreterState *interp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue