parameters: (self, exit)
return_statement: return exit
docstring: Registers a callback with the standard __exit__ method signature.
  
          Can suppress exceptions the same way __exit__ method can.
          Also accepts any object with an __exit__ method (registering a call
          to the method instead of the object itself).
docstring_summary: Registers a callback with the standard __exit__ method signature.
docstring_tokens: Registers a callback with the standard __exit__ method signature .
function: def push(self, exit):
          """Registers a callback with the standard __exit__ method signature.
  
          Can suppress exceptions the same way __exit__ method can.
          Also accepts any object with an __exit__ method (registering a call
          to the method instead of the object itself).
          """
          # We use an unbound method rather than a bound method to follow
          # the standard lookup behaviour for special methods.
          _cb_type = type(exit)
  
          try:
              exit_method = _cb_type.__exit__
          except AttributeError:
              # Not a context manager, so assume it's a callable.
              self._push_exit_callback(exit)
          else:
              self._push_cm_exit(exit, exit_method)
          return exit
function_tokens: def push ( self , exit ) : # We use an unbound method rather than a bound method to follow # the standard lookup behaviour for special methods. _cb_type = type ( exit ) try : exit_method = _cb_type . __exit__ except AttributeError : # Not a context manager, so assume it's a callable. self . _push_exit_callback ( exit ) else : self . _push_cm_exit ( exit , exit_method ) return exit