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

Method format_stack_entry

tools/python-3.11.9-amd64/Lib/bdb.py:551–579  ·  view source on GitHub ↗

Return a string with information about a stack entry. The stack entry frame_lineno is a (frame, lineno) tuple. The return string contains the canonical filename, the function name or ' ', the input arguments, the return value, and the line of code (if it

(self, frame_lineno, lprefix=': ')

Source from the content-addressed store, hash-verified

549 return stack, i
550
551 def format_stack_entry(self, frame_lineno, lprefix=': '):
552 """Return a string with information about a stack entry.
553
554 The stack entry frame_lineno is a (frame, lineno) tuple. The
555 return string contains the canonical filename, the function name
556 or '<lambda>', the input arguments, the return value, and the
557 line of code (if it exists).
558
559 """
560 import linecache, reprlib
561 frame, lineno = frame_lineno
562 filename = self.canonic(frame.f_code.co_filename)
563 s = '%s(%r)' % (filename, lineno)
564 if frame.f_code.co_name:
565 s += frame.f_code.co_name
566 else:
567 s += "<lambda>"
568 s += '()'
569 if '__return__' in frame.f_locals:
570 rv = frame.f_locals['__return__']
571 s += '->'
572 s += reprlib.repr(rv)
573 if lineno is not None:
574 line = linecache.getline(filename, lineno, frame.f_globals)
575 if line:
576 s += lprefix + line.strip()
577 else:
578 s += f'{lprefix}Warning: lineno is None'
579 return s
580
581 # The following methods can be called by clients to use
582 # a debugger to debug a statement or an expression.

Callers 1

print_stack_entryMethod · 0.80

Calls 4

canonicMethod · 0.95
stripMethod · 0.80
reprMethod · 0.45
getlineMethod · 0.45

Tested by

no test coverage detected