]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117385: Remove unhooked events on sys.settrace (GH-117386)
authorTian Gao <gaogaotiantian@hotmail.com>
Fri, 26 Apr 2024 16:01:44 +0000 (09:01 -0700)
committerGitHub <noreply@github.com>
Fri, 26 Apr 2024 16:01:44 +0000 (17:01 +0100)
Misc/NEWS.d/next/Core and Builtins/2024-03-30-00-37-53.gh-issue-117385.h0OJti.rst [new file with mode: 0644]
Python/legacy_tracing.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-03-30-00-37-53.gh-issue-117385.h0OJti.rst b/Misc/NEWS.d/next/Core and Builtins/2024-03-30-00-37-53.gh-issue-117385.h0OJti.rst
new file mode 100644 (file)
index 0000000..2e385df
--- /dev/null
@@ -0,0 +1 @@
+Remove unhandled ``PY_MONITORING_EVENT_BRANCH`` and ``PY_MONITORING_EVENT_EXCEPTION_HANDLED`` events from :func:`sys.settrace`.
index d7aae7d2343ac2a82d2b1e044be92e8184193592..b5a174059318253a3788dce77677b7bbf5e89b50 100644 (file)
@@ -599,10 +599,9 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
             (1 << PY_MONITORING_EVENT_PY_START) | (1 << PY_MONITORING_EVENT_PY_RESUME) |
             (1 << PY_MONITORING_EVENT_PY_RETURN) | (1 << PY_MONITORING_EVENT_PY_YIELD) |
             (1 << PY_MONITORING_EVENT_RAISE) | (1 << PY_MONITORING_EVENT_LINE) |
-            (1 << PY_MONITORING_EVENT_JUMP) | (1 << PY_MONITORING_EVENT_BRANCH) |
+            (1 << PY_MONITORING_EVENT_JUMP) |
             (1 << PY_MONITORING_EVENT_PY_UNWIND) | (1 << PY_MONITORING_EVENT_PY_THROW) |
-            (1 << PY_MONITORING_EVENT_STOP_ITERATION) |
-            (1 << PY_MONITORING_EVENT_EXCEPTION_HANDLED);
+            (1 << PY_MONITORING_EVENT_STOP_ITERATION);
 
         PyFrameObject* frame = PyEval_GetFrame();
         if (frame->f_trace_opcodes) {