Runtime Data Attributes

traceback.tb_lasti

Bytecode instruction offset recorded at the exception site. Unlike live frame state, this refers to the traceback event; it is not a line number.

Formal Syntax & Structure

python syntaxpython
tb.tb_lasti

Return Value

int

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_lasti >= 0)
Python Reference