def __exit__(self, exc_type, exc_value, tb): self.assign_variable.__exit__(exc_type, exc_value, tb) if self.captured and not self.close_on_capture: self.close_on_del = True else: if self.close() and exc_type is None: raise CleanupFailed()
def __exit__(self, exc_type, exc_value, tb): any_failed = False for task in self.tasks: try: task() except: any_failed = True report(traceback.format_exc()) self.assign_variable.__exit__(exc_type, exc_value, tb) if exc_type is None and any_failed: raise CleanupFailed()
def __exit__(self, exc_type, exc_value, tb): self.assign_variable.__exit__(exc_type, exc_value, tb) if self.close() and exc_type is None: raise CleanupFailed()