Skip to content

Support multi-line statements in pdb #103124

Closed
@gaogaotiantian

Description

@gaogaotiantian

Feature or enhancement

Support multi-line statements in pdb just like in normal Python interactive shells

Pitch

Currently, we have this:

(Pdb) def f():
*** IndentationError: expected an indented block after function definition on line 1
(Pdb) 

We can have this:

(Pdb) def f():
...     pass
...   
(Pdb) 

The fundamental logic is handled by codeop.compile_command, we just need to port it in.

It's kind of a breaking change, as the behavior for the once failed single-line check only code could potentially work. For example, we have this in the error case check:

(Pdb) print(
*** SyntaxError: '(' was never closed"

And it won't be failing anymore as we can close it in the next line. But in general, I believe this feature has more benifits than problems.

I'll make the PR draft for now and wait for some more discussion on the matter.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions