From: Collin Winter Date: Sun, 11 Mar 2007 16:00:20 +0000 (+0000) Subject: Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexErr... X-Git-Tag: v2.6a1~2051 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2faa9e146681bb4d5ea2b795dfaade35a1d1c2df;p=python Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number. Will backport. --- diff --git a/Lib/pdb.py b/Lib/pdb.py index f56941e8d1..2ec736b262 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: diff --git a/Misc/NEWS b/Misc/NEWS index 8d93d0130c..24d7a1433b 100644 --- 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.