summaryrefslogtreecommitdiffstats
path: root/Lib/bdb.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-11-29 11:54:17 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-11-29 11:54:17 (GMT)
commit6f1070485f54469d7bf48df8306e398609340a07 (patch)
tree08eda3c912bb78c17b0655e140161da0213126d7 /Lib/bdb.py
parentead22227cce112457b6beba8b008699ea4a3a084 (diff)
downloadcpython-6f1070485f54469d7bf48df8306e398609340a07.zip
cpython-6f1070485f54469d7bf48df8306e398609340a07.tar.gz
cpython-6f1070485f54469d7bf48df8306e398609340a07.tar.bz2
Fix #10561 - Fix pdb behavior. Delete the breakpoints by breakpoint number.
Handle multiple breakpoints at same line. Update docs/test. Patch by Xavier de Gaye.
Diffstat (limited to 'Lib/bdb.py')
-rw-r--r--Lib/bdb.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/bdb.py b/Lib/bdb.py
index e599847..0cb2e92 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -252,6 +252,12 @@ class Bdb:
list.append(lineno)
bp = Breakpoint(filename, lineno, temporary, cond, funcname)
+ def _prune_breaks(self, filename, lineno):
+ if (filename, lineno) not in Breakpoint.bplist:
+ self.breaks[filename].remove(lineno)
+ if not self.breaks[filename]:
+ del self.breaks[filename]
+
def clear_break(self, filename, lineno):
filename = self.canonic(filename)
if not filename in self.breaks:
@@ -263,17 +269,15 @@ class Bdb:
# pair, then remove the breaks entry
for bp in Breakpoint.bplist[filename, lineno][:]:
bp.deleteMe()
- if (filename, lineno) not in Breakpoint.bplist:
- self.breaks[filename].remove(lineno)
- if not self.breaks[filename]:
- del self.breaks[filename]
+ self._prune_breaks(filename, lineno)
def clear_bpbynumber(self, arg):
try:
bp = self.get_bpbynumber(arg)
except ValueError as err:
return str(err)
- self.clear_break(bp.file, bp.line)
+ bp.deleteMe()
+ self._prune_breaks(bp.file, bp.line)
def clear_all_file_breaks(self, filename):
filename = self.canonic(filename)