]> git.ipfire.org Git - thirdparty/Python/cpython.git/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:04:01 +0000 (16:04 +0000)
committerCollin Winter <collinw@gmail.com>
Sun, 11 Mar 2007 16:04:01 +0000 (16:04 +0000)
Backport of r54271.

Lib/pdb.py
Misc/NEWS

index f08241ffbc353c41f552dd237282d357ea277a47..f355d45e6ef52ec94345d4a103034544da50ac99 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 47137be18deaa5ffbdb30727ae76542590855530..97c21461e7941ca56e8f53c18a86e6c9630f9aa2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -199,6 +199,9 @@ Extension Modules
 Library
 -------
 
+- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap
+  the IndexError caused by passing in an invalid breakpoint number.
+
 - Bug #1531963: Make SocketServer.TCPServer's server_address always
   be equal to calling getsockname() on the server's socket. Fixed by patch
   #1545011.