MCPcopy Index your code
hub / github.com/python/cpython / __call__

Method __call__

Lib/multiprocessing/util.py:276–298  ·  view source on GitHub ↗

Run the callback unless it has already been called or cancelled

(self, wr=None,
                 # Need to bind these locally because the globals can have
                 # been cleared at shutdown
                 _finalizer_registry=_finalizer_registry,
                 sub_debug=sub_debug, getpid=os.getpid)

Source from the content-addressed store, hash-verified

274 _finalizer_registry[self._key] = self
275
276 def __call__(self, wr=None,
277 # Need to bind these locally because the globals can have
278 # been cleared at shutdown
279 _finalizer_registry=_finalizer_registry,
280 sub_debug=sub_debug, getpid=os.getpid):
281 '''
282 Run the callback unless it has already been called or cancelled
283 '''
284 try:
285 del _finalizer_registry[self._key]
286 except KeyError:
287 sub_debug('finalizer no longer registered')
288 else:
289 if self._pid != getpid():
290 sub_debug('finalizer ignored because different process')
291 res = None
292 else:
293 sub_debug('finalizer calling %s with args %s and kwargs %s',
294 self._callback, self._args, self._kwargs)
295 res = self._callback(*self._args, **self._kwargs)
296 self._weakref = self._callback = self._args = \
297 self._kwargs = self._key = None
298 return res
299
300 def cancel(self):
301 '''

Callers

nothing calls this directly

Calls 1

sub_debugFunction · 0.85

Tested by

no test coverage detected