Skip to content

bpo-41510: Updated documentation to add header kw-argument of pdb.set_trace()#21793

Open
ShubhamKJha wants to merge 1 commit into
python:mainfrom
ShubhamKJha:bpo41510
Open

bpo-41510: Updated documentation to add header kw-argument of pdb.set_trace()#21793
ShubhamKJha wants to merge 1 commit into
python:mainfrom
ShubhamKJha:bpo41510

Conversation

@ShubhamKJha
Copy link
Copy Markdown

@ShubhamKJha ShubhamKJha commented Aug 9, 2020

Copy link
Copy Markdown
Contributor

@m-aciek m-aciek left a comment

Choose a reason for hiding this comment

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

In my (humble) opinion we can omit that extra information about new argument of set_trace in this contexts. It would be great if someone else (maybe some core commiter) expressed his (her) opinion on that.

Comment thread Doc/library/functions.rst
Comment on lines +137 to 142
:func:`pdb.set_trace()` expecting an optional keyword argument `header`. 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:`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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
:func:`pdb.set_trace()` expecting an optional keyword argument `header`. 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:`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.
:func:`pdb.set_trace()`, however it can be set to some other function and
:func:`breakpoint` will automatically call that, allowing you to drop into
the debugger of choice.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I understand, but if we are providing information about the standard hook then we must provide what behavior it would show (i.e, arguments' info)

Comment thread Doc/library/sys.rst
@@ -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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here also I would suggest dropping that extra information.

Suggested change
The signature of this function is dependent on what it calls. For example,
The signature of this function is dependent on what it calls. The built-in
``breakpoint()`` function passes its ``*args`` and ``**kws`` straight through.
Whatever ``breakpointhooks()`` returns is returned from ``breakpoint()``.

Comment thread Doc/library/functions.rst
: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
Copy link
Copy Markdown
Contributor

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".

Copy link
Copy Markdown
Author

@ShubhamKJha ShubhamKJha Aug 14, 2020

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 .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ohh I see. Thanks.

Copy link
Copy Markdown
Contributor

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

A sentence-ending period may be followed by one or two spaces; while reST ignores the second space, it is customarily put in by some users, for example to aid Emacs’ auto-fill mode.

@ShubhamKJha
Copy link
Copy Markdown
Author

Hi @nanjekyejoannah this can be merged, I guess.

Copy link
Copy Markdown
Contributor

@nanjekyejoannah nanjekyejoannah left a comment

Choose a reason for hiding this comment

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

I will cc @ronaldoussoren for an opinion.

Copy link
Copy Markdown
Contributor

@ronaldoussoren ronaldoussoren left a comment

Choose a reason for hiding this comment

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

I'm leaving my feedback as a comment because I don't have really clear feedback.

I wonder if changing the text is necessary, other than maybe a slight rewording because the current text says the default hook won't accept any arguments which is untrue. I wouldn't document the keyword argument of pdb.set_trace here, IMHO that just makes the documentation harder to understand.

Note that the breakpoint function is intended to make it easy to drop in a debugger. I'd expect that most of not all calls to the breakpoint function will have no arguments.

Comment thread Doc/library/functions.rst
: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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

@gaogaotiantian
Copy link
Copy Markdown
Member

Do you still want to work on this PR @ShubhamKJha ? I can help to move it forward.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

9 participants