Runtime Data Attributes
traceback.tb_frame
Frame associated with one traceback node. Access may raise an audit event; avoid retaining or exposing frame namespaces beyond debugging needs.
Formal Syntax & Structure
python syntaxpython
tb.tb_frameReturn Value
types.FrameType
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
def fail(): raise ValueError('demo')try: fail()except ValueError as e: tb = e.__traceback__.tb_nextprint(tb.tb_frame.f_code.co_name)