]> granicus.if.org Git - python/commitdiff
Bug #1627316: handle error in condition/ignore pdb commands more gracefully.
authorGeorg Brandl <georg@python.org>
Mon, 22 Jan 2007 21:23:41 +0000 (21:23 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 22 Jan 2007 21:23:41 +0000 (21:23 +0000)
Lib/pdb.py

index dfa6fc8246edb5b422e017f58c4544da75ae4b86..865b5b54078314b94619e28f54769cb8b3409ddb 100755 (executable)
@@ -474,7 +474,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
     def do_condition(self, arg):
         # arg is breakpoint number and condition
         args = arg.split(' ', 1)
-        bpnum = int(args[0].strip())
+        try:
+            bpnum = int(args[0].strip())
+        except ValueError:
+            # something went wrong
+            print >>self.stdout, \
+                'Breakpoint index %r is not a number' % args[0]
         try:
             cond = args[1]
         except:
@@ -489,7 +494,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
     def do_ignore(self,arg):
         """arg is bp number followed by ignore count."""
         args = arg.split()
-        bpnum = int(args[0].strip())
+        try:
+            bpnum = int(args[0].strip())
+        except ValueError:
+            # something went wrong
+            print >>self.stdout, \
+                'Breakpoint index %r is not a number' % args[0]
         try:
             count = int(args[1].strip())
         except: