Set a new breakpoint for filename:lineno. If lineno doesn't exist for the filename, return an error message. The filename should be in canonical form.
(self, filename, lineno, temporary=False, cond=None,
funcname=None)
| 669 | bp_linenos.append(lineno) |
| 670 | |
| 671 | def set_break(self, filename, lineno, temporary=False, cond=None, |
| 672 | funcname=None): |
| 673 | """Set a new breakpoint for filename:lineno. |
| 674 | |
| 675 | If lineno doesn't exist for the filename, return an error message. |
| 676 | The filename should be in canonical form. |
| 677 | """ |
| 678 | filename = self.canonic(filename) |
| 679 | import linecache # Import as late as possible |
| 680 | line = linecache.getline(filename, lineno) |
| 681 | if not line: |
| 682 | return 'Line %s:%d does not exist' % (filename, lineno) |
| 683 | self._add_to_breaks(filename, lineno) |
| 684 | bp = Breakpoint(filename, lineno, temporary, cond, funcname) |
| 685 | # After we set a new breakpoint, we need to search through all frames |
| 686 | # and set f_trace to trace_dispatch if there could be a breakpoint in |
| 687 | # that frame. |
| 688 | frame = self.enterframe |
| 689 | while frame: |
| 690 | if self.break_anywhere(frame): |
| 691 | frame.f_trace = self.trace_dispatch |
| 692 | frame = frame.f_back |
| 693 | return None |
| 694 | |
| 695 | def _load_breaks(self): |
| 696 | """Apply all breakpoints (set in other instances) to this one. |
no test coverage detected