-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-120254: Add a commands argument to pdb.set_trace
#120255
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 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
76a633e
Add commands argument to pdb.Pdb
gaogaotiantian 88635c2
Add docs
gaogaotiantian ac5c2ac
📜🤖 Added by blurb_it.
blurb-it[bot] b188729
Update 2024-06-08-03-29-01.gh-issue-120254.h682ke.rst
gaogaotiantian 613442f
Update 2024-06-08-03-29-01.gh-issue-120254.h682ke.rst
gaogaotiantian 0a7a52f
Merge branch 'main' into pdb-commands
gaogaotiantian 80826ab
Move commands argument to set_trace
gaogaotiantian 0eb5d3b
Remove old added entry
gaogaotiantian 7db612b
Update 2024-06-08-03-29-01.gh-issue-120254.h682ke.rst
gaogaotiantian f802cd6
Update 2024-06-08-03-29-01.gh-issue-120254.h682ke.rst
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,7 +192,7 @@ The ``run*`` functions and :func:`set_trace` are aliases for instantiating the | |
| access further features, you have to do this yourself: | ||
|
|
||
| .. class:: Pdb(completekey='tab', stdin=None, stdout=None, skip=None, \ | ||
| nosigint=False, readrc=True) | ||
| nosigint=False, readrc=True, commands=None) | ||
|
|
||
| :class:`Pdb` is the debugger class. | ||
|
|
||
|
|
@@ -211,6 +211,9 @@ access further features, you have to do this yourself: | |
| The *readrc* argument defaults to true and controls whether Pdb will load | ||
| .pdbrc files from the filesystem. | ||
|
|
||
| The *commands* argument, if given, would be a list of commands to execute | ||
| when the debugger starts. It has similar effects to the :file:`.pdbrc` file. | ||
|
||
|
|
||
| Example call to enable tracing with *skip*:: | ||
|
|
||
| import pdb; pdb.Pdb(skip=['django.*']).set_trace() | ||
|
|
@@ -227,6 +230,9 @@ access further features, you have to do this yourself: | |
| .. versionchanged:: 3.6 | ||
| The *readrc* argument. | ||
|
|
||
| .. versionadded:: 3.14 | ||
| The *commands* argument. | ||
|
|
||
| .. method:: run(statement, globals=None, locals=None) | ||
| runeval(expression, globals=None, locals=None) | ||
| runcall(function, *args, **kwds) | ||
|
|
||
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
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2024-06-08-03-29-01.gh-issue-120254.h682ke.rst
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1 @@ | ||||||
| Added ``commands`` argument to :class:`pdb.Pdb` which allows user to send debugger commands in the source file. | ||||||
|
||||||
| Added ``commands`` argument to :class:`pdb.Pdb` which allows user to send debugger commands in the source file. | |
| Added ``commands`` argument to :class:`pdb.Pdb` which allows users to send debugger commands in the source file. |
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.
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.
Do you think two "those" is a little bit confusing here? How about These commands are executed after any commands optionally provided by the :file:
.pdbrcfile?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.
I agree the double "those" is confusing.
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.
Oups, you're right! I'm sorry I didn't reply to your question 3 weeks ago btw, but yes your suggestion is way better!