-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
bpo-41510: Updated documentation to add header kw-argument of pdb.set_trace()
#21793
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -134,9 +134,9 @@ are always available. They are listed here in alphabetical order. | |||||||||||||||||||
| This function drops you into the debugger at the call site. Specifically, | ||||||||||||||||||||
| it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight | ||||||||||||||||||||
| through. By default, ``sys.breakpointhook()`` calls | ||||||||||||||||||||
| :func:`pdb.set_trace()` expecting no arguments. In this case, it is | ||||||||||||||||||||
| purely a convenience function so you don't have to explicitly import | ||||||||||||||||||||
| :mod:`pdb` or type as much code to enter the debugger. However, | ||||||||||||||||||||
| :func:`pdb.set_trace()` expecting an optional keyword argument `header`. In | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a native english speaker, but "expecting an optional ..." doesn't feel right. I'm not sure if anything needs to change here, expect maybe to rephrase the current text to indicate that the default hook can be called without arguments. Users can look up the documentation of pdb.set_trace for advanced usage. |
||||||||||||||||||||
| this case, it is purely a convenience function so you don't have to explicitly | ||||||||||||||||||||
| import :mod:`pdb` or type as much code to enter the debugger. However, | ||||||||||||||||||||
| :func:`sys.breakpointhook` can be set to some other function and | ||||||||||||||||||||
| :func:`breakpoint` will automatically call that, allowing you to drop into | ||||||||||||||||||||
| the debugger of choice. | ||||||||||||||||||||
|
Comment on lines
+137
to
142
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not an expert, but I wonder if we can leave those details behind.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand, but if we are providing information about the standard |
||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -189,10 +189,10 @@ always available. | |||||||||
| function so that you can choose which debugger gets used. | ||||||||||
|
|
||||||||||
| The signature of this function is dependent on what it calls. For example, | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here also I would suggest dropping that extra information.
Suggested change
|
||||||||||
| the default binding (e.g. ``pdb.set_trace()``) expects no arguments, but | ||||||||||
| you might bind it to a function that expects additional arguments | ||||||||||
| (positional and/or keyword). The built-in ``breakpoint()`` function passes | ||||||||||
| its ``*args`` and ``**kws`` straight through. Whatever | ||||||||||
| the default binding (e.g. ``pdb.set_trace()``) expects only an optional keyword | ||||||||||
| argument `header`, but you might bind it to a function that expects additional | ||||||||||
| arguments (positional and/or keyword). The built-in ``breakpoint()`` function | ||||||||||
| passes its ``*args`` and ``**kws`` straight through. Whatever | ||||||||||
| ``breakpointhooks()`` returns is returned from ``breakpoint()``. | ||||||||||
|
|
||||||||||
| The default implementation first consults the environment variable | ||||||||||
|
|
||||||||||
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.
My eyes may be wrong but there might be an extra space before "In".
Uh oh!
There was an error while loading. Please reload this page.
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.
In .rst files I guess there must be 2 spaces after
.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.
ohh I see. Thanks.
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.
https://devguide.python.org/documenting/#use-of-whitespace