MCPcopy Index your code
hub / github.com/RustPython/RustPython / set_break

Method set_break

Lib/bdb.py:671–693  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

do_breakMethod · 0.45

Calls 5

canonicMethod · 0.95
_add_to_breaksMethod · 0.95
break_anywhereMethod · 0.95
BreakpointClass · 0.85
getlineMethod · 0.45

Tested by

no test coverage detected