You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Modified the failing test because print( is a valid command now(it will wait for the closing parenthesis). Added multiline statement tests. This is an intuitive feature so no new documentation is required.
Activity
gaogaotiantian commentedon Apr 9, 2023
Modified the failing test because
print(is a valid command now(it will wait for the closing parenthesis). Added multiline statement tests. This is an intuitive feature so no new documentation is required.gaogaotiantian commentedon May 7, 2023
@iritkatriel and @brandtbucher , do you think we still have a chance to merge this in for 3.12? I do think this is a significant improvement for pdb.
brandtbucher commentedon May 10, 2023
I agree, and I'm sorry we didn't have the time to review this for 3.12. I'm looking forward to reviewing this improvement for 3.13, though!
GH-103124: Multiline statement support for pdb (GH-103125)
Merge branch 'main' into modulelocals
pythonGH-103124: Multiline statement support for pdb (pythonGH-103125)