From c8965ffabb1030e32c491e67c2dcf4450c7fce77 Mon Sep 17 00:00:00 2001 From: fdt Date: Tue, 22 Jul 2025 19:10:04 +0800 Subject: [PATCH 1/5] Remove unused C tracing code in bdb The `c_call`, `c_return`, and `c_exception` events have historically (since c69ebe8d50529eae281275c841428eb9b375a442) been dispatched to `c_profilefunc` and never `c_tracefunc`. This commit removes the dead code related to `c_tracefunc` dispatching. --- Doc/library/bdb.rst | 6 +----- Lib/bdb.py | 11 +---------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Doc/library/bdb.rst b/Doc/library/bdb.rst index 90f042aa377711..77f8f90d7c7ea9 100644 --- a/Doc/library/bdb.rst +++ b/Doc/library/bdb.rst @@ -192,12 +192,8 @@ The :mod:`bdb` module also defines two classes: entered. * ``"return"``: A function or other code block is about to return. * ``"exception"``: An exception has occurred. - * ``"c_call"``: A C function is about to be called. - * ``"c_return"``: A C function has returned. - * ``"c_exception"``: A C function has raised an exception. - For the Python events, specialized functions (see below) are called. For - the C events, no action is taken. + For the Python events, specialized functions (see below) are called. The *arg* parameter depends on the previous event. diff --git a/Lib/bdb.py b/Lib/bdb.py index 4290ef22302a42..6642019515ba1d 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -267,12 +267,9 @@ def trace_dispatch(self, frame, event, arg): is entered. return: A function or other code block is about to return. exception: An exception has occurred. - c_call: A C function is about to be called. - c_return: A C function has returned. - c_exception: A C function has raised an exception. For the Python events, specialized functions (see the dispatch_*() - methods) are called. For the C events, no action is taken. + methods) are called. The arg parameter depends on the previous event. """ @@ -288,12 +285,6 @@ def trace_dispatch(self, frame, event, arg): return self.dispatch_return(frame, arg) if event == 'exception': return self.dispatch_exception(frame, arg) - if event == 'c_call': - return self.trace_dispatch - if event == 'c_exception': - return self.trace_dispatch - if event == 'c_return': - return self.trace_dispatch if event == 'opcode': return self.dispatch_opcode(frame, arg) print('bdb.Bdb.dispatch: unknown debugging event:', repr(event)) From 8bfd9684c17b2cb11081188597e86706d92d1b1c Mon Sep 17 00:00:00 2001 From: fdt Date: Wed, 23 Jul 2025 19:55:15 +0800 Subject: [PATCH 2/5] Remove 'Python' from docs which previously distinguishing from c events --- Doc/library/bdb.rst | 2 +- Lib/bdb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/bdb.rst b/Doc/library/bdb.rst index 77f8f90d7c7ea9..c7a3e0c596b9d0 100644 --- a/Doc/library/bdb.rst +++ b/Doc/library/bdb.rst @@ -193,7 +193,7 @@ The :mod:`bdb` module also defines two classes: * ``"return"``: A function or other code block is about to return. * ``"exception"``: An exception has occurred. - For the Python events, specialized functions (see below) are called. + For all the events, specialized functions (see below) are called. The *arg* parameter depends on the previous event. diff --git a/Lib/bdb.py b/Lib/bdb.py index 6642019515ba1d..c5993150106ccd 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -268,7 +268,7 @@ def trace_dispatch(self, frame, event, arg): return: A function or other code block is about to return. exception: An exception has occurred. - For the Python events, specialized functions (see the dispatch_*() + For all the events, specialized functions (see the dispatch_*() methods) are called. The arg parameter depends on the previous event. From a60511dafc3a5ea5c0e80f031c04ef602a150f93 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 11:59:49 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst diff --git a/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst b/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst new file mode 100644 index 00000000000000..476ef4f9248c63 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst @@ -0,0 +1 @@ +Remove unused C tracing code in bdb for event type `c_call`, `c_return` and `c_exception` From 5800fadab0fb09740d976bd2662c58414481b5e5 Mon Sep 17 00:00:00 2001 From: fdt Date: Wed, 23 Jul 2025 23:49:38 +0800 Subject: [PATCH 4/5] Trim tail space --- Lib/bdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/bdb.py b/Lib/bdb.py index c5993150106ccd..efc3e0a235ac8e 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -268,7 +268,7 @@ def trace_dispatch(self, frame, event, arg): return: A function or other code block is about to return. exception: An exception has occurred. - For all the events, specialized functions (see the dispatch_*() + For all the events, specialized functions (see the dispatch_*() methods) are called. The arg parameter depends on the previous event. From ad8028fd32c9c7198c2c61f3ef88f01b0adc1127 Mon Sep 17 00:00:00 2001 From: fdt Date: Wed, 23 Jul 2025 23:53:26 +0800 Subject: [PATCH 5/5] For inline literals, use double backticks --- .../next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst b/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst index 476ef4f9248c63..a7111dd2b865ba 100644 --- a/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst +++ b/Misc/NEWS.d/next/Library/2025-07-23-11-59-48.gh-issue-136980.BIJzkB.rst @@ -1 +1 @@ -Remove unused C tracing code in bdb for event type `c_call`, `c_return` and `c_exception` +Remove unused C tracing code in bdb for event type ``c_call``, ``c_return`` and ``c_exception``