summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-02-13 14:16:37 (GMT)
committerGitHub <noreply@github.com>2024-02-13 14:16:37 (GMT)
commitf9f6156c5affc039d4ee6b6f4999daf0d5896428 (patch)
tree063a0d3da50ec32d1bdd265d0b305f9365ced7da /Python/pystate.c
parent7cce8576226249461baa91c4a89770a1823b44a4 (diff)
downloadcpython-f9f6156c5affc039d4ee6b6f4999daf0d5896428.zip
cpython-f9f6156c5affc039d4ee6b6f4999daf0d5896428.tar.gz
cpython-f9f6156c5affc039d4ee6b6f4999daf0d5896428.tar.bz2
GH-113710: Backedge counter improvements. (GH-115166)
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 937c430..996f465 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -625,9 +625,7 @@ init_interpreter(PyInterpreterState *interp,
}
interp->sys_profile_initialized = false;
interp->sys_trace_initialized = false;
- interp->optimizer = &_PyOptimizer_Default;
- interp->optimizer_backedge_threshold = _PyOptimizer_Default.backedge_threshold;
- interp->optimizer_resume_threshold = _PyOptimizer_Default.backedge_threshold;
+ (void)_Py_SetOptimizer(interp, NULL);
interp->next_func_version = 1;
interp->executor_list_head = NULL;
if (interp != &runtime->_main_interpreter) {
@@ -780,10 +778,8 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
tstate->_status.cleared = 0;
}
- Py_CLEAR(interp->optimizer);
- interp->optimizer = &_PyOptimizer_Default;
- interp->optimizer_backedge_threshold = _PyOptimizer_Default.backedge_threshold;
- interp->optimizer_resume_threshold = _PyOptimizer_Default.backedge_threshold;
+ _PyOptimizerObject *old = _Py_SetOptimizer(interp, NULL);
+ Py_DECREF(old);
/* It is possible that any of the objects below have a finalizer
that runs Python code or otherwise relies on a thread state