ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
preprocessor.receiver_classes Namespace Reference

Functions

 _constructed_classes (value, classes, returns)
 _is_subclass (cls, name, classes, seen=frozenset())
 _has_outside_base (cls, classes, seen=frozenset())
 _classinfo_names (node)
 _mro (cls, classes, seen=frozenset())
 _c3_merge (seqs)
 _defining_class (cls, attr, classes)
 _scope_nodes (body)
 _name_bindings (body)
 _receiver_classes (body, classes, returns)
 _binds_names_or_attributes (node)
 _is_tracked_read (node, parent)
 _check_escapes (body, receivers, module_name)
 _isinstance_answer (cls, classinfo, classes)
 _header_nodes (stmt)
 _isinstance_receiver (node, receivers)
 _scope_blocks (body)
 _single_class (stmt, classes, returns)
 _definite_classes (body, receivers, classes, returns)
 _static_classes (body, receivers, classes, returns)
 _check_isinstance (node, receivers, classes, context, module_name)
 _outside_names (body, params)
 _isinstance_context (body, receivers, classes, returns, params)
 _parameters (func)
 _spine_construction (stmt, name, classes)
 _own_nodes (body)
 _binding_nodes (body, name)
 _read_in_nested_scope (name, module, scope)
 _read_only_as_receiver (name, body)
 _rebound_on_spine (name, module, scope, classes)
 _scope_receivers (scope, module, classes, returns)
 _check_scope (scope, module, classes, returns, module_name)
 _check_inline_constructions (module, classes, returns, module_name)
 refuse_path_dependent_receivers (module, module_name)

Detailed Description

Refuse an attribute read or isinstance on a name whose class depends on the
path (#8408, #8407).

A name holds one C type, the class it is first bound to. When it is bound to
instances of different classes, a method call, attribute read or isinstance on
it would be resolved against that one class on every path.

Function Documentation

◆ _binding_nodes()

preprocessor.receiver_classes._binding_nodes ( body,
name )
protected
The nodes of this scope that bind `name`.

◆ _binds_names_or_attributes()

preprocessor.receiver_classes._binds_names_or_attributes ( node)
protected

◆ _c3_merge()

preprocessor.receiver_classes._c3_merge ( seqs)
protected
The C3 merge of the linearisations `seqs`, or None when they conflict.

◆ _check_escapes()

preprocessor.receiver_classes._check_escapes ( body,
receivers,
module_name )
protected
Refuse a receiver stored or passed anywhere else: the container or
parameter takes the C type of one class.

◆ _check_inline_constructions()

preprocessor.receiver_classes._check_inline_constructions ( module,
classes,
returns,
module_name )
protected
Refuse a conditional construction of different classes anywhere but as
the value of an assignment, where the receiver checks see it.

◆ _check_isinstance()

preprocessor.receiver_classes._check_isinstance ( node,
receivers,
classes,
context,
module_name )
protected
Refuse isinstance on a path-dependent receiver unless its answer is
known: the check reads the receiver's one static class.

◆ _check_scope()

preprocessor.receiver_classes._check_scope ( scope,
module,
classes,
returns,
module_name )
protected
Check the module or a function `scope`.

◆ _classinfo_names()

preprocessor.receiver_classes._classinfo_names ( node)
protected
The names an isinstance classinfo lists, or None for any other form.

◆ _constructed_classes()

preprocessor.receiver_classes._constructed_classes ( value,
classes,
returns )
protected
The classes `value` constructs, directly or through a function
annotated to return one, or None when it is anything else.

◆ _defining_class()

preprocessor.receiver_classes._defining_class ( cls,
attr,
classes )
protected
The class whose body defines `attr` as a method, searching the bases
in C3 order; None when no class of this module defines it. A method no
class defines is missing from every class alike. A class with no MRO
answers itself, so that it is never taken to share a method.

◆ _definite_classes()

preprocessor.receiver_classes._definite_classes ( body,
receivers,
classes,
returns )
protected
Per isinstance call on a receiver, the class a constructor bound the
receiver to earlier in the same block, with no rebinding in between.

◆ _has_outside_base()

preprocessor.receiver_classes._has_outside_base ( cls,
classes,
seen = frozenset() )
protected
Whether a base of class `cls`, direct or inherited, is not a class of
this module (other than object), so its ancestry is not known here.

◆ _header_nodes()

preprocessor.receiver_classes._header_nodes ( stmt)
protected
The nodes of `stmt` outside its nested statements and scopes.

◆ _is_subclass()

preprocessor.receiver_classes._is_subclass ( cls,
name,
classes,
seen = frozenset() )
protected
Whether class `cls` of this module is `name` or derives from it.

◆ _is_tracked_read()

preprocessor.receiver_classes._is_tracked_read ( node,
parent )
protected
Whether a read of a receiver as `node` under `parent` is one this pass
tracks or leaves to the converter: an attribute read on it, an isinstance,
type or identity test, a return, a store to an attribute, or a copy to a
name, which makes that name a receiver too.

◆ _isinstance_answer()

preprocessor.receiver_classes._isinstance_answer ( cls,
classinfo,
classes )
protected
isinstance's answer for an instance of class `cls`, or None when it is
not known here.

◆ _isinstance_context()

preprocessor.receiver_classes._isinstance_context ( body,
receivers,
classes,
returns,
params )
protected
The definite class at each isinstance call and each receiver's static
class, without a parameter or a global, which take their C type from
outside this scope.

◆ _isinstance_receiver()

preprocessor.receiver_classes._isinstance_receiver ( node,
receivers )
protected
The receiver `node` tests with isinstance, or None.

◆ _mro()

preprocessor.receiver_classes._mro ( cls,
classes,
seen = frozenset() )
protected
The C3 linearisation of class `cls` over the classes of this module,
or None when it has none.

◆ _name_bindings()

preprocessor.receiver_classes._name_bindings ( body)
protected
The (target name, value) of each assignment in this scope to names.

◆ _outside_names()

preprocessor.receiver_classes._outside_names ( body,
params )
protected
A scope's parameters and globals, which take their C type from outside
the scope.

◆ _own_nodes()

preprocessor.receiver_classes._own_nodes ( body)
protected
The nodes of a scope, without descending into any def, lambda or class.

◆ _parameters()

preprocessor.receiver_classes._parameters ( func)
protected

◆ _read_in_nested_scope()

preprocessor.receiver_classes._read_in_nested_scope ( name,
module,
scope )
protected
Whether a function, lambda or class other than `scope` names `name`.

◆ _read_only_as_receiver()

preprocessor.receiver_classes._read_only_as_receiver ( name,
body )
protected
Whether every read of `name` in this scope is an attribute access on it
or an isinstance test of it.

◆ _rebound_on_spine()

preprocessor.receiver_classes._rebound_on_spine ( name,
module,
scope,
classes )
protected
Whether every binding of `name` in `scope` (a top-level function, or
the module when None) constructs a class at the top level of the scope,
and the name is read only as a receiver and in no other scope. The
converter then gives each rebinding to another class its own symbol, so
the name holds one class at each read.

◆ _receiver_classes()

preprocessor.receiver_classes._receiver_classes ( body,
classes,
returns )
protected
Per name bound in this scope to instances of more than one class of
this module, directly or through a copy of another name, the set of those
classes.

◆ _scope_blocks()

preprocessor.receiver_classes._scope_blocks ( body)
protected

◆ _scope_nodes()

preprocessor.receiver_classes._scope_nodes ( body)
protected
The nodes of a scope, without descending into nested scopes.

◆ _scope_receivers()

preprocessor.receiver_classes._scope_receivers ( scope,
module,
classes,
returns )
protected
The receivers of the module or a function `scope`, without those the
converter rebinds on the spine of the module or a top-level function.

◆ _single_class()

preprocessor.receiver_classes._single_class ( stmt,
classes,
returns )
protected
The name `stmt` binds and the one class it constructs, or None.

◆ _spine_construction()

preprocessor.receiver_classes._spine_construction ( stmt,
name,
classes )
protected
Whether `stmt` binds `name`, and only it, to a direct construction of a
class of this module.

◆ _static_classes()

preprocessor.receiver_classes._static_classes ( body,
receivers,
classes,
returns )
protected
Per receiver, the class of its first binding in source order, which
gives the name its C type; None when that binding is not a constructor.

◆ refuse_path_dependent_receivers()

preprocessor.receiver_classes.refuse_path_dependent_receivers ( module,
module_name )