PyDocs

Nav

Python Runtime Services

getframeinfo

inspect

function (source)
  • getframeinfo(frame, context=1)
Get information about a frame or traceback object.

A tuple of five things is returned: 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 second argument specifies the number of lines of context
to return, which are centered around the current line.
Changed in 3.11
  • 3.11: A Traceback object is returned instead of a named tuple.
0 Examples
No examples for inspect/getframeinfo.
See Also
No see-alsos for inspect/getframeinfo
0 Notes
No notes for getframeinfo