-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-121450: Make inline breakpoints use the most recent pdb instance #121451
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
634725c
Make inline breakpoints use the most recent pdb instance
gaogaotiantian c15480c
📜🤖 Added by blurb_it.
blurb-it[bot] a72864d
Fix docs/comments
gaogaotiantian dbe8be4
Merge branch 'main' into pdb-singleton
gaogaotiantian 9233cc7
Set _last_pdb_instance in Pdb.set_trace()
gaogaotiantian 6d438a3
Update news
gaogaotiantian fa7574b
Does not need the explicit instantiation anymore
gaogaotiantian b15c3b2
Fix lint
gaogaotiantian 73b0e9f
Add what's new entry
gaogaotiantian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Make inline breakpoints use the most recent pdb instance
- Loading branch information
commit 634725c0b60b2d8abaaa113852980be520d4e6da
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we're creating this instance while debugging? It would overwrite the instance from the hard coded breakpoint, and this one will be reused at the next hard coded breakpoint. This is not what's intended right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Pdb._last_pdb_instance should be set in set_trace().
Probably need a test for this scenario too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean in
Pdb.set_trace()
? That would make some sense, only enlist the instance when it explicitly takes over the tracing.However, if the user somehow creates and uses a pdb instance before a
breakpoint()
, we really can't determine the purpose. It could be nested debugging (debug
command in pdb which I think we should patch to make sure the_last_pdb_instance
is not modified). Or the user could want a new instance, for example, in the test cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand. If you set
_last_pdb_instance
inPdb.set_trace()
then you get clear semantics, and no other breakpoint interrupts with this. Is that not a good thing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I agree that setting
_last_pdb_instance
inPdb.set_trace()
is a good approach. And I just realized the nested debugging (debug
command in pdb) usessys.call_tracing
so it probably won't affect anything if we do it inPdb.set_trace()
. I'll do the change and see how it works out.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this change actually made the test change unnecessary so it's good. Do you think we need to test more scenarios? I think the case where users explicitly create a
Pdb
instance in the pdb prompt is really rare - what's the point?