type-frame
Frame objects
Frame objects represent execution frames. They may occur in traceback objects (see type-traceback).
Special read-only attributes:
- f_back is to the previous stack frame (towards the caller), or None if this is the bottom stack frame.
- f_code is the code object being executed in this frame.
- f_locals is the dictionary used to look up local variables.
- f_globals is used for global variables.
- f_builtins is used for built-in (intrinsic) names.
- f_restricted is a flag indicating whether the function is executing in restricted execution mode.
- f_lasti gives the precise instruction (this is an index into the bytecode string of the code object).
Special writable attributes:
- f_trace, if not None, is a function called at the start of each source code line (this is used by the debugger).
- f_exc_type, f_exc_value, f_exc_traceback represent the last exception raised in the parent frame provided another exception was ever raised in the current frame (in all other cases they are None).
- f_lineno is the current line number of the frame — writing to this from within a trace function jumps to the given line (only for the bottom-most frame). A debugger can implement a Jump command (aka Set Next Statement) by writing to f_lineno.