Monero
Loading...
Searching...
No Matches
py2backports.weakref.finalize Class Reference
Inheritance diagram for py2backports.weakref.finalize:
Collaboration diagram for py2backports.weakref.finalize:

Classes

class  _Info

Public Member Functions

 __init__ (self, obj, func, *args, **kwargs)
 __call__ (self, _=None)
 detach (self)
 peek (self)
 alive (self)
 atexit (self)
 atexit (self, value)
 __repr__ (self)

Protected Member Functions

 _select_for_exit (cls)
 _exitfunc (cls)

Protected Attributes

 _exitfunc

Static Protected Attributes

dict _registry = {}
bool _shutdown = False
 _index_iter = itertools.count()
bool _dirty = False
bool _registered_with_atexit = False

Static Private Attributes

tuple __slots__ = ()

Detailed Description

Class for finalization of weakrefable objects
finalize(obj, func, *args, **kwargs) returns a callable finalizer
object which will be called when obj is garbage collected. The
first time the finalizer is called it evaluates func(*arg, **kwargs)
and returns the result. After this the finalizer is dead, and
calling it just returns None.
When the program exits any remaining finalizers for which the
atexit attribute is true will be run in reverse order of creation.
By default atexit is true.

Constructor & Destructor Documentation

◆ __init__()

py2backports.weakref.finalize.__init__ ( self,
obj,
func,
* args,
** kwargs )

Member Function Documentation

◆ __call__()

py2backports.weakref.finalize.__call__ ( self,
_ = None )
If alive then mark as dead and return func(*args, **kwargs);
otherwise return None

◆ __repr__()

py2backports.weakref.finalize.__repr__ ( self)

◆ _exitfunc()

py2backports.weakref.finalize._exitfunc ( cls)
protected

◆ _select_for_exit()

py2backports.weakref.finalize._select_for_exit ( cls)
protected

◆ alive()

py2backports.weakref.finalize.alive ( self)
Whether finalizer is alive

◆ atexit() [1/2]

py2backports.weakref.finalize.atexit ( self)
Whether finalizer should be called at exit

◆ atexit() [2/2]

py2backports.weakref.finalize.atexit ( self,
value )

◆ detach()

py2backports.weakref.finalize.detach ( self)
If alive then mark as dead and return (obj, func, args, kwargs);
otherwise return None

◆ peek()

py2backports.weakref.finalize.peek ( self)
If alive then return (obj, func, args, kwargs);
otherwise return None

Member Data Documentation

◆ __slots__

tuple py2backports.weakref.finalize.__slots__ = ()
staticprivate

◆ _dirty

bool py2backports.weakref.finalize._dirty = False
staticprotected

◆ _exitfunc

py2backports.weakref.finalize._exitfunc
protected

◆ _index_iter

py2backports.weakref.finalize._index_iter = itertools.count()
staticprotected

◆ _registered_with_atexit

bool py2backports.weakref.finalize._registered_with_atexit = False
staticprotected

◆ _registry

dict py2backports.weakref.finalize._registry = {}
staticprotected

◆ _shutdown

bool py2backports.weakref.finalize._shutdown = False
staticprotected

The documentation for this class was generated from the following file: