On this page
inspect.getinnerframes
Prev: inspect.getgeneratorstate | Up: inspect | Next: inspect.getlineno
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getinnerframes
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getinnerframes
Signature & Overview
inspect.getinnerframes(tb, context=1)
Get a list of records for a traceback's frame and all lower frames.
Usage
import inspect
try:
1 / 0
except ZeroDivisionError as exc:
frames = inspect.getinnerframes(exc.__traceback__)
assert len(frames) >= 1 and frames[-1].lineno > 0
Gotchas
- Walks downward from a traceback to the exact raising line: Last element is the innermost frame where the exception occurred.
REPL Inspect
from inspect import getinnerframes
help(getinnerframes)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getgeneratorstate Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getlineno Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib