diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst b/Misc/NEWS.d/next/Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst new file mode 100644 index 000000000000000..fa1a59ec927bb8e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst @@ -0,0 +1 @@ +Reset ``ceval.eval_breaker`` in :func:`interpreter_clear` diff --git a/Python/pystate.c b/Python/pystate.c index 2086bd619df9125..92cf741f4ca4ed2 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -890,6 +890,10 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate) Py_CLEAR(interp->audit_hooks); + // At this time, all the threads should be cleared so we don't need + // atomic operations for eval_breaker + interp->ceval.eval_breaker = 0; + for (int i = 0; i < _PY_MONITORING_UNGROUPED_EVENTS; i++) { interp->monitors.tools[i] = 0; }