Skip to content

[3.13] gh-125378: Trigger a repeat for the full multi-line statement for empty line command (GH-125717) #125736

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

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ def default(self, line):
else:
line = line.rstrip('\r\n')
buffer += '\n' + line
self.lastcmd = buffer
save_stdout = sys.stdout
save_stdin = sys.stdin
save_displayhook = sys.displayhook
Expand Down
16 changes: 13 additions & 3 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,12 @@ def test_pdb_multiline_statement():
... 'def f(x):',
... ' return x * 2',
... '',
... 'f(2)',
... 'val = 2',
... 'if val > 0:',
... ' val = f(val)',
... '',
... '', # empty line should repeat the multi-line statement
... 'val',
... 'c'
... ]):
... test_function()
Expand All @@ -2302,8 +2307,13 @@ def test_pdb_multiline_statement():
(Pdb) def f(x):
... return x * 2
...
(Pdb) f(2)
4
(Pdb) val = 2
(Pdb) if val > 0:
... val = f(val)
...
(Pdb)
(Pdb) val
8
(Pdb) c
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the bug in :mod:`pdb` where after a multi-line command, an empty line repeats the first line of the multi-line command, instead of the full command.
Loading