[Python-checkins] r54271 - in python/trunk: Lib/pdb.py Misc/NEWS

collin.winter python-checkins at python.org
Sun Mar 11 17:00:23 CET 2007


Author: collin.winter
Date: Sun Mar 11 17:00:20 2007
New Revision: 54271

Modified:
   python/trunk/Lib/pdb.py
   python/trunk/Misc/NEWS
Log:
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.


Modified: python/trunk/Lib/pdb.py
==============================================================================
--- python/trunk/Lib/pdb.py	(original)
+++ python/trunk/Lib/pdb.py	Sun Mar 11 17:00:20 2007
@@ -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:

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Mar 11 17:00:20 2007
@@ -158,6 +158,9 @@
 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.


More information about the Python-checkins mailing list