parameters: (self, cm, cm_exit)
docstring: Helper to correctly register callbacks to __exit__ methods
docstring_summary: Helper to correctly register callbacks to __exit__ methods
docstring_tokens: Helper to correctly register callbacks to __exit__ methods
function: def _push_cm_exit(self, cm, cm_exit):
          """Helper to correctly register callbacks to __exit__ methods"""
          def _exit_wrapper(*exc_details):
              return cm_exit(cm, *exc_details)
          _exit_wrapper.__self__ = cm
          self.push(_exit_wrapper)
function_tokens: def _push_cm_exit ( self , cm , cm_exit ) : def _exit_wrapper ( * exc_details ) : return cm_exit ( cm , * exc_details ) _exit_wrapper . __self__ = cm self . push ( _exit_wrapper )