]> granicus.if.org Git - python/commitdiff
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexErr...
authorCollin Winter <collinw@gmail.com>
Sun, 11 Mar 2007 16:00:20 +0000 (16:00 +0000)
committerCollin Winter <collinw@gmail.com>
Sun, 11 Mar 2007 16:00:20 +0000 (16:00 +0000)
Will backport.

Lib/pdb.py
Misc/NEWS

index f56941e8d18149de7599120cb94cf0408ab28932..2ec736b2627e750825a64c3fd3ef69c9027d398f 100755 (executable)
@@ -485,7 +485,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
             cond = args[1]
         except:
             cond = None
-        bp = bdb.Breakpoint.bpbynumber[bpnum]
+        try:
+            bp = bdb.Breakpoint.bpbynumber[bpnum]
+        except IndexError:
+            print >>self.stdout, 'Breakpoint index %r is not valid' % args[0]
+            return
         if bp:
             bp.cond = cond
             if not cond:
@@ -506,7 +510,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
             count = int(args[1].strip())
         except:
             count = 0
-        bp = bdb.Breakpoint.bpbynumber[bpnum]
+        try:
+            bp = bdb.Breakpoint.bpbynumber[bpnum]
+        except IndexError:
+            print >>self.stdout, 'Breakpoint index %r is not valid' % args[0]
+            return
         if bp:
             bp.ignore = count
             if count > 0:
index 8d93d0130c2e19c65aed9119a34c7537b9e653ef..24d7a1433bfb2d62efde34a25c375ecabee7d0a7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -158,6 +158,9 @@ Core and builtins
 Library
 -------
 
+- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap
+  the IndexError caused by passing in an invalid breakpoint number.
+
 - Patch #1599845: Add an option to disable the implicit calls to server_bind()
   and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer
   and DocXMLRPCServer.