PyFrameObject

subclass of PyVarObject

Members

Functions

f_localsplus
PyObject** f_localsplus()

locals+stack, dynamically sized

Variables

f_back
PyFrameObject* f_back;

previous frame, or NULL

f_blockstack
PyTryBlock[CO_MAXBLOCKS] f_blockstack;

for try and loop blocks

f_builtins
PyObject* f_builtins;

builtin symbol table (PyDictObject)

f_code
PyCodeObject* f_code;

code segment

f_exc_traceback
PyObject* f_exc_traceback;

_

f_exc_type
PyObject* f_exc_type;

If an exception is raised in this frame, the next three are used to record the exception info (if any) originally in the thread state. See comments before set_exc_info() -- it's not obvious. Invariant: if _type is NULL, then so are _value and _traceback. Desired invariant: all three are NULL, or all three are non-NULL. That one isn't currently true, but "should be".

f_exc_value
PyObject* f_exc_value;

_

f_globals
PyObject* f_globals;

global symbol table (PyDictObject)

f_iblock
int f_iblock;

index in f_blockstack

f_lasti
int f_lasti;

Last instruction if called

f_lineno
int f_lineno;

Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is active (i.e. when f_trace is set). At other times we use PyCode_Addr2Line to calculate the line from the current bytecode index.

f_locals
PyObject* f_locals;

local symbol table (any mapping)

f_ncells
int f_ncells;
f_nfreevars
int f_nfreevars;

Availability: 2.4

f_nlocals
int f_nlocals;

Availability: 2.4

f_restricted
int f_restricted;
f_stacksize
int f_stacksize;

Availability: 2.4

f_stacktop
PyObject** f_stacktop;

Next free slot in f_valuestack. Frame creation sets to f_valuestack. Frame evaluation usually NULLs it, but a frame that yields sets it to the current stack top.

f_trace
PyObject* f_trace;

Trace function

f_tstate
PyThreadState* f_tstate;

_

f_valuestack
PyObject** f_valuestack;

points after the last local

Meta