Runtime Data Attributes

traceback.tb_next

Next inner traceback node, towards the failing frame; None terminates the chain. Writable since 3.7, with cycles rejected by CPython.

Formal Syntax & Structure

python syntaxpython
tb.tb_next

Return Value

types.TracebackType | None

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__print((tb.tb_next.tb_frame.f_code.co_name,tb.tb_next.tb_next is None))
Python Reference