MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / checkline

Method checkline

tools/python-3.11.9-amd64/Lib/pdb.py:812–832  ·  view source on GitHub ↗

Check whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive.

(self, filename, lineno)

Source from the content-addressed store, hash-verified

810 return answer or failed
811
812 def checkline(self, filename, lineno):
813 """Check whether specified line seems to be executable.
814
815 Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
816 line or EOF). Warning: testing is not comprehensive.
817 """
818 # this method should be callable before starting debugging, so default
819 # to "no globals" if there is no current frame
820 frame = getattr(self, 'curframe', None)
821 globs = frame.f_globals if frame else None
822 line = linecache.getline(filename, lineno, globs)
823 if not line:
824 self.message('End of file')
825 return 0
826 line = line.strip()
827 # Don't allow setting breakpoint at a blank line
828 if (not line or (line[0] == '#') or
829 (line[:3] == '"""') or line[:3] == "'''"):
830 self.error('Blank or comment')
831 return 0
832 return lineno
833
834 def do_enable(self, arg):
835 """enable bpnumber [bpnumber ...]

Callers 1

do_breakMethod · 0.95

Calls 4

messageMethod · 0.95
errorMethod · 0.95
stripMethod · 0.80
getlineMethod · 0.45

Tested by

no test coverage detected