Skip to content

Commit e44a670

Browse files
committed
End commands entry on 'end' and ^C and ^D
1 parent 90e0a81 commit e44a670

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/pdb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,6 +2706,7 @@ def do_commands(self, arg):
27062706
]
27072707
# fmt: on
27082708

2709+
end_cmds += ["end"] # pseudo-command
27092710
self._send(commands_entry={"bpnum": bnum, "terminators": end_cmds})
27102711
return
27112712

@@ -2875,8 +2876,10 @@ def prompt_for_breakpoint_command_list(self, prompt):
28752876
cmd = self.pdb_instance.parseline(line)[0]
28762877
if cmd in self.command_list_terminators:
28772878
break
2878-
except EOFError:
2879-
return
2879+
except (KeyboardInterrupt, EOFError):
2880+
print(flush=True)
2881+
print("command definition aborted, old commands restored")
2882+
break
28802883
finally:
28812884
self.commands_mode = False
28822885

0 commit comments

Comments
 (0)