

def __exit__(self, exc_type, exc_val, exc_tb):
    with self.database._conn_lock:
        if (self.connection is None):
            self.database.pop_execution_context()
        else:
            try:
                if self.with_transaction:
                    if (not exc_type):
                        self.txn.commit(False)
                    self.txn.__exit__(exc_type, exc_val, exc_tb)
            finally:
                self.database.pop_execution_context()
                self.database._close(self.connection)

dataset/ETHPy150Open coleifer/peewee/peewee.py ExecutionContext.__exit__/original