]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110752: Reset `ceval.eval_breaker` to 0 in `interpreter_clear` (GH-110753)
authorTian Gao <gaogaotiantian@hotmail.com>
Thu, 12 Oct 2023 14:10:21 +0000 (07:10 -0700)
committerGitHub <noreply@github.com>
Thu, 12 Oct 2023 14:10:21 +0000 (15:10 +0100)
Misc/NEWS.d/next/Core and Builtins/2023-10-12-06-32-25.gh-issue-110752.FYfI0h.rst [new file with mode: 0644]
Python/pystate.c

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 (file)
index 0000000..fa1a59e
--- /dev/null
@@ -0,0 +1 @@
+Reset ``ceval.eval_breaker`` in :func:`interpreter_clear`
index 2086bd619df9125b2b7a6d43f43a8c7db6fbb85a..92cf741f4ca4ed2b160744d3790986fffb28ad52 100644 (file)
@@ -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;
     }