MCPcopy Index your code
hub / github.com/python/cpython / walk_stack

Function walk_stack

Lib/traceback.py:398–412  ·  view source on GitHub ↗

Walk a stack yielding the frame and line number for each frame. This will follow f.f_back from the given frame. If no frame is given, the current stack is used. Usually used with StackSummary.extract.

(f)

Source from the content-addressed store, hash-verified

396
397
398def walk_stack(f):
399 """Walk a stack yielding the frame and line number for each frame.
400
401 This will follow f.f_back from the given frame. If no frame is given, the
402 current stack is used. Usually used with StackSummary.extract.
403 """
404 if f is None:
405 f = sys._getframe().f_back
406
407 def walk_stack_generator(frame):
408 while frame is not None:
409 yield frame, frame.f_lineno
410 frame = frame.f_back
411
412 return walk_stack_generator(f)
413
414
415def walk_tb(tb):

Callers 1

extract_stackFunction · 0.85

Calls 1

walk_stack_generatorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…