MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/weakref.py:468–483  ·  view source on GitHub ↗
(self, obj, func, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

466 __slots__ = ("weakref", "func", "args", "kwargs", "atexit", "index")
467
468 def __init__(self, obj, func, /, *args, **kwargs):
469 if not self._registered_with_atexit:
470 # We may register the exit function more than once because
471 # of a thread race, but that is harmless
472 import atexit
473 atexit.register(self._exitfunc)
474 finalize._registered_with_atexit = True
475 info = self._Info()
476 info.weakref = ref(obj, self)
477 info.func = func
478 info.args = args
479 info.kwargs = kwargs or None
480 info.atexit = True
481 info.index = next(self._index_iter)
482 self._registry[self] = info
483 finalize._dirty = True
484
485 def __call__(self, _=None):
486 """If alive then mark as dead and return func(*args, **kwargs);

Callers

nothing calls this directly

Calls 2

nextFunction · 0.85
registerMethod · 0.45

Tested by

no test coverage detected