3.11.4 The interpreter stack

When the following functions return ``frame records,'' each record is a tuple of six items: the frame object, the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. The optional context argument specifies the number of lines of context to return, which are centered around the current line.

getouterframes(frame[, context])
Get a list of frame records for a frame and all higher (calling) frames.

getinnerframes(traceback[, context])
Get a list of frame records for a traceback's frame and all lower frames.

currentframe()
Return the frame object for the caller's stack frame.

stack([context])
Return a list of frame records for the stack above the caller's frame.

trace([context])
Return a list of frame records for the stack below the current exception.
See About this document... for information on suggesting changes.