summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-03-11 16:04:01 (GMT)
committerCollin Winter <collinw@gmail.com>2007-03-11 16:04:01 (GMT)
commit3e43bcc78e2716eda822eab3cd08da206b0b8f35 (patch)
tree1ec27a9c715140aabcc7e40aec12dc6050aadd31 /Lib/pdb.py
parentad3d2c2fe496c824292720e0c6f5265634503cb0 (diff)
downloadcpython-3e43bcc78e2716eda822eab3cd08da206b0b8f35.zip
cpython-3e43bcc78e2716eda822eab3cd08da206b0b8f35.tar.gz
cpython-3e43bcc78e2716eda822eab3cd08da206b0b8f35.tar.bz2
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.
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py12
1 files changed, 10 insertions, 2 deletions
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 @@ 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: