From 1e3460d9faaffb35b3c6175c666b1f45aea2c1d8 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Thu, 12 Oct 2023 07:10:21 -0700 Subject: gh-110752: Reset `ceval.eval_breaker` to 0 in `interpreter_clear` (GH-110753) --- .../Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst | 1 + Python/pystate.c | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst 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 0000000..fa1a59e --- /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 2086bd6..92cf741 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; } -- cgit v0.12