Skip to content

Commit adb5c95

Browse files
committed
gh-149015: Fix iterate-and-delete issue in Bdb.clear_all_file_breaks
When multiple breakpoints share the same line, iterating over blist while calling bp.deleteMe() (which mutates blist) causes alternate elements to be skipped, leaving orphan breakpoints. This is a one-character fix: add [:] to create a copy before iterating, matching the existing defensive pattern in clear_break() at line 722.
1 parent c62c371 commit adb5c95

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/bdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def clear_all_file_breaks(self, filename):
747747
return 'There are no breakpoints in %s' % filename
748748
for line in self.breaks[filename]:
749749
blist = Breakpoint.bplist[filename, line]
750-
for bp in blist:
750+
for bp in blist[:]:
751751
bp.deleteMe()
752752
del self.breaks[filename]
753753
return None

0 commit comments

Comments
 (0)