Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Backport of r54271.
diff --git a/Lib/pdb.py b/Lib/pdb.py
index f08241f..f355d45 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -485,7 +485,11 @@
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 @@
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:
diff --git a/Misc/NEWS b/Misc/NEWS
index 47137be..97c2146 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -199,6 +199,9 @@
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.