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

Function getouterframes

Lib/inspect.py:1653–1664  ·  view source on GitHub ↗

Get a list of records for a frame and all higher (calling) frames. Each record contains a frame object, filename, line number, function name, a list of lines of context, and index within the context.

(frame, context=1)

Source from the content-addressed store, hash-verified

1651 self.code_context, self.index, self.positions))
1652
1653def getouterframes(frame, context=1):
1654 """Get a list of records for a frame and all higher (calling) frames.
1655
1656 Each record contains a frame object, filename, line number, function
1657 name, a list of lines of context, and index within the context."""
1658 framelist = []
1659 while frame:
1660 traceback_info = getframeinfo(frame, context)
1661 frameinfo = (frame,) + traceback_info
1662 framelist.append(FrameInfo(*frameinfo, positions=traceback_info.positions))
1663 frame = frame.f_back
1664 return framelist
1665
1666def getinnerframes(tb, context=1):
1667 """Get a list of records for a traceback's frame and all lower frames.

Callers 1

stackFunction · 0.85

Calls 3

getframeinfoFunction · 0.85
FrameInfoClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…