Skip to content

Use 4 spaces for indentation in PDB #125377

Closed

Description

@treyhunner

Feature or enhancement

Proposal:

It looks like PDB evolved the ability to handle multi-line Python expressions in Python 3.13. I didn't see this mentioned in the release notes, but I'm excited to see this feature. Thank you to whoever added this feature! (@gaogaotiantian maybe?)

I did notice that the Tab key works in a somewhat unexpected way.

When I hit Enter at the end of an if True: line, I see:

image

Then if I hit the Tab key I see this:

image

Note that a tab character is inserted (just as one would be within the old Python REPL) but the tab width looks like 2 spaces.

I expected to see this instead:

image

In the old Python REPL, the Tab key used to insert a tab character, but it looked like 4 spaces were inserted because the tab stop happened to be 4 characters from the end of the >>> prompt (which is 4 characters long):

image

One way to resolve this would be to shorten the PDB prompt to something like (P) or PDB .

I would propose instead that the Tab key should insert 4 spaces in PDB (just as the new REPL does).

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. savannahostrowski commented on Oct 12, 2024

    @savannahostrowski
    Member

    @gaogaotiantian for input

  2. added a commit that references this issue on Mar 4, 2025
  3. gaogaotiantian commented on Mar 4, 2025

    @gaogaotiantian
    Member

    Thanks for raising this up. This is implemented in #130471 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions