Skip to content

gh-136980: Remove unused C tracing code in bdb #136981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

FredericDT
Copy link

@FredericDT FredericDT commented Jul 22, 2025

Since bdb was created, it uses sys.settrace for tracing.

The c_call, c_return, and c_exception events have historically (since c69ebe8) been dispatched to c_profilefunc and never c_tracefunc. This commit removes the dead code related to c_tracefunc dispatching.

Refers to c69ebe8#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deR3426-R3461


📚 Documentation preview 📚: https://cpython-previews--136981.org.readthedocs.build/

The `c_call`, `c_return`, and `c_exception` events have historically (since c69ebe8) been dispatched to `c_profilefunc` and never `c_tracefunc`. This commit removes the dead code related to `c_tracefunc` dispatching.
@python-cla-bot
Copy link

python-cla-bot bot commented Jul 22, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Jul 22, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@FredericDT FredericDT changed the title gh136980: Remove unused C tracing code in bdb gh-136980: Remove unused C tracing code in bdb Jul 22, 2025
Copy link
Member

@gaogaotiantian gaogaotiantian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall this should be a safe change. trace_dispatchis the lowest API and there's no (proper) way a subclass can change how it is triggered. (Just thinking about potential backwards compatibility issues).

You do need a news entry here because it's still technically a behavior change.


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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess Python does not make sense here anymore - it's all the events.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I have them in 8bfd968

Lib/bdb.py Outdated
@@ -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_*()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we don't need to distinguish Python events anymore.

@bedevere-app
Copy link

bedevere-app bot commented Jul 23, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants