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

Method push_async_exit

Lib/contextlib.py:667–677  ·  view source on GitHub ↗

Registers a coroutine function with the standard __aexit__ method signature. Can suppress exceptions the same way __aexit__ method can. Also accepts any object with an __aexit__ method (registering a call to the method instead of the object itself).

(self, exit)

Source from the content-addressed store, hash-verified

665 return result
666
667 def push_async_exit(self, exit):
668 """Registers a coroutine function with the standard __aexit__ method
669 signature.
670
671 Can suppress exceptions the same way __aexit__ method can.
672 Also accepts any object with an __aexit__ method (registering a call
673 to the method instead of the object itself).
674 """
675 exit_method = _lookup_special(exit, '__aexit__', exit)
676 self._push_exit_callback(exit_method, False)
677 return exit # Allow use as a decorator
678
679 def push_async_callback(self, callback, /, *args, **kwds):
680 """Registers an arbitrary coroutine function and arguments.

Calls 2

_lookup_specialFunction · 0.85
_push_exit_callbackMethod · 0.80