class Frame(utils.ContextWeakrefMixin): (source)
An interpreter frame. This contains the local value and block stacks and the associated code and pointer. The most complex usage is with generators in which a frame is stored and then repeatedly reactivated. Other than that frames are created executed and then discarded. Attributes: f_code: The code object this frame is executing. f_globals: The globals dict used for global name resolution. f_locals: The locals used for name resolution. Will be modified by Frame.__init__ if callargs is passed. f_builtins: Similar for builtins. f_back: The frame above self on the stack. f_lineno: The first line number of the code object. ctx: The abstract context we belong to. node: The node at which the frame is created. states: A mapping from opcodes to FrameState objects. cells: local variables bound in a closure, or used in a closure. block_stack: A stack of blocks used to manage exceptions, loops, and "with"s. data_stack: The value stack that is used for instruction operands. allowed_returns: The return annotation of this function. check_return: Whether the actual return type of a call should be checked against allowed_returns. return_variable: The return value of this function, as a Variable. yield_variable: The yield value of this function, as a Variable.
Method | __init__ |
Initialize a special frame as needed by TypegraphVirtualMachine. |
Method | __repr__ |
Undocumented |
Method | lookup |
Undocumented |
Instance Variable | allowed |
Undocumented |
Instance Variable | cells |
Undocumented |
Instance Variable | check |
Undocumented |
Instance Variable | class |
Undocumented |
Instance Variable | current |
Undocumented |
Instance Variable | current |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | f |
Undocumented |
Instance Variable | first |
Undocumented |
Instance Variable | func |
Undocumented |
Instance Variable | node |
Undocumented |
Instance Variable | overloads |
Undocumented |
Instance Variable | return |
Undocumented |
Instance Variable | skip |
Undocumented |
Instance Variable | states |
Undocumented |
Instance Variable | substs |
Undocumented |
Instance Variable | targets |
Undocumented |
Instance Variable | yield |
Undocumented |
Property | type |
Undocumented |
Inherited from ContextWeakrefMixin
:
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
cfg.CFGNode
, ctx: _ContextType
, f_code: blocks.OrderedCode
, f_globals: abstract.LazyConcreteDict
, f_locals: abstract.LazyConcreteDict
, f_back: FrameType
, callargs: Dict[ str, cfg.Variable]
, closure: Optional[ Tuple[ cfg.Variable, ...]]
, func: Optional[ cfg.Binding]
, first_arg: Optional[ cfg.Variable]
, substs: Collection[ Dict[ str, cfg.Variable]]
):
(source)
¶
Initialize a special frame as needed by TypegraphVirtualMachine. Args: node: The current CFG graph node. ctx: The owning abstract context. f_code: The code object to execute in this frame. f_globals: The global context to execute in as a SimpleValue as used by TypegraphVirtualMachine. f_locals: Local variables. Will be modified if callargs is passed. f_back: The frame above this one on the stack. callargs: Additional function arguments to store in f_locals. closure: A tuple containing the new co_freevars. func: Optionally, a binding to the function this frame corresponds to. first_arg: First argument to the function. substs: Maps from type parameter names in scope for this frame to their possible values. Raises: NameError: If we can't resolve any references into the outer frame.