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

Method callback

Lib/contextlib.py:536–547  ·  view source on GitHub ↗

Registers an arbitrary callback and arguments. Cannot suppress exceptions.

(self, callback, /, *args, **kwds)

Source from the content-addressed store, hash-verified

534 return result
535
536 def callback(self, callback, /, *args, **kwds):
537 """Registers an arbitrary callback and arguments.
538
539 Cannot suppress exceptions.
540 """
541 _exit_wrapper = self._create_cb_wrapper(callback, *args, **kwds)
542
543 # We changed the signature, so using @wraps is not appropriate, but
544 # setting __wrapped__ may still help with introspection.
545 _exit_wrapper.__wrapped__ = callback
546 self._push_exit_callback(_exit_wrapper)
547 return callback # Allow use as a decorator
548
549 def _push_exit_callback(self, callback, is_sync=True):
550 self._exit_callbacks.append((is_sync, callback))

Callers

nothing calls this directly

Calls 2

_create_cb_wrapperMethod · 0.95
_push_exit_callbackMethod · 0.95

Tested by

no test coverage detected