Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-120144: Refactor bdb monitoring backend to match settrace behavior#132484
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Hi@iritkatriel , this PR basically just make it clearer how the monitoring backend behavior matches the settrace bahavior, while fixing a small bug. Hope it won't be too much work to review :) |
iritkatriel approved these changesApr 13, 2025
Wow that was fast! Thanks! |
084d6dc intopython:main 46 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
The existing behavior of bdb's monitoring backend does not fully match what
sys.settracedoes. The update foropcodeevents is separated from the other local events, which does not quite make sense.This PR unifies the event handling -
update_local_events()will simply checkf_traceandf_trace_opcodeto decide what events should be enabled for that code object.This actually cleans up the logic for the monitoring backend.
The
check_trace_opcodes()is removed fromstop_trace()becauseclear_iddoes the work.There was a small bug in the original code -
check_trace_opcodeswill actually erase the workcheck_trace_funcdoes. It did not matter because we always dostart_trace()when we start trace and we are only interested in opcode events. However, theoretically it's still wrong. Now it has the correct behavior.This is not really "user observable", so it should be considered as a refactoring. (However it blocks something I'm working on for async stuff).
sys.monitoringfor pdb/bdb #120144