

def __exit__(self, exc_type, exc_val, exc_tb):
    with self._lock:
        cur = self._cur_stack.pop()
        self.putcur(cur)
        if exc_type:
            self._conn.rollback()
        else:
            self._conn.commit()
        if (self._conn and (not self._cur_stack) and (not self.to_keep_conn)):
            self.putconn(self._conn)
            self._conn = None

dataset/ETHPy150Open moskytw/mosql/mosql/db.py Database.__exit__/original