]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#8015: fix crash when entering an empty line for breakpoint commands. Also restore...
authorGeorg Brandl <georg@python.org>
Fri, 30 Jul 2010 08:54:49 +0000 (08:54 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 30 Jul 2010 08:54:49 +0000 (08:54 +0000)
Lib/pdb.py
Misc/NEWS

index cedd17ed71209eb84bf90dede4e36638147d765a..e62f91368bd8072bd7260c03365f9b1a1795f483 100755 (executable)
@@ -509,8 +509,10 @@ class Pdb(bdb.Bdb, cmd.Cmd):
             return self.handle_command_def(line)
 
     def handle_command_def(self,line):
-        """ Handles one command line during command list definition. """
+        """Handles one command line during command list definition."""
         cmd, arg, line = self.parseline(line)
+        if not cmd:
+            return
         if cmd == 'silent':
             self.commands_silent[self.commands_bnum] = True
             return # continue to handle other cmd def in the cmd list
@@ -518,7 +520,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
             self.cmdqueue = []
             return 1 # end of cmd list
         cmdlist = self.commands[self.commands_bnum]
-        if (arg):
+        if arg:
             cmdlist.append(cmd+' '+arg)
         else:
             cmdlist.append(cmd)
@@ -561,9 +563,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
         prompt_back = self.prompt
         self.prompt = '(com) '
         self.commands_defining = True
-        self.cmdloop()
-        self.commands_defining = False
-        self.prompt = prompt_back
+        try:
+            self.cmdloop()
+        finally:
+            self.commands_defining = False
+            self.prompt = prompt_back
 
     def do_break(self, arg, temporary = 0):
         # break [ ([filename:]lineno | function) [, "condition"] ]
index a68cc73b32c89a765a2918a0dbccc5eccdc8abd4..5c61594424f476237e0f0620a51e9dee1cb6ac4a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -475,6 +475,9 @@ C-API
 Library
 -------
 
+- Issue #8015: In pdb, do not crash when an empty line is entered as
+  a breakpoint command.
+
 - In pdb, allow giving a line number to the "until" command.
 
 - Issue #1437051: For pdb, allow "continue" and related commands in