def _printlonglist(self, linerange=None):
try:
if self.curframe.f_code.co_name == '<module>':
# inspect.getsourcelines is buggy in this case: if we just
# pass the frame, it returns the source for the first function
# defined in the module. Instead, we want the full source
# code of the module
lines, _ = inspect.findsource(self.curframe)
lineno = 1
else:
try:
lines, lineno = inspect.getsourcelines(self.curframe)
except Exception as e:
print('** Error in inspect.getsourcelines: %s **' % e, file=self.stdout)
return
except IOError as e:
print('** Error: %s **' % e, file=self.stdout)
return
if linerange:
start, end = linerange
start = max(start, lineno)
end = min(end, lineno+len(lines))
lines = lines[start-lineno:end-lineno]
lineno = start
self._print_lines_pdbpp(lines, lineno)
评论列表
文章目录