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

Function extract_stack

Lib/traceback.py:251–264  ·  view source on GitHub ↗

Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line number, function name, text), a

(f=None, limit=None)

Source from the content-addressed store, hash-verified

249
250
251def extract_stack(f=None, limit=None):
252 """Extract the raw traceback from the current stack frame.
253
254 The return value has the same format as for extract_tb(). The
255 optional 'f' and 'limit' arguments have the same meaning as for
256 print_stack(). Each item in the list is a quadruple (filename,
257 line number, function name, text), and the entries are in order
258 from oldest to newest stack frame.
259 """
260 if f is None:
261 f = sys._getframe().f_back
262 stack = StackSummary.extract(walk_stack(f), limit=limit)
263 stack.reverse()
264 return stack
265
266
267def clear_frames(tb):

Callers 3

doTracebackMethod · 0.90
print_stackFunction · 0.70
format_stackFunction · 0.70

Calls 3

walk_stackFunction · 0.85
extractMethod · 0.45
reverseMethod · 0.45

Tested by 1

doTracebackMethod · 0.72