From 78175bcca5781e213074eaaeb5f64bad5387f432 Mon Sep 17 00:00:00 2001 From: Zaar Hai Date: Wed, 26 Aug 2015 21:39:33 +0300 Subject: [PATCH] Don't try to rollback if connection was closed --- momoko/connection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/momoko/connection.py b/momoko/connection.py index b0ba7c8..6598eb4 100644 --- a/momoko/connection.py +++ b/momoko/connection.py @@ -821,10 +821,10 @@ def exec_statements(future): cursor = future.result() cursors.append(cursor) except Exception as error: - if not auto_rollback: - transaction_future.set_exc_info(sys.exc_info()) - else: + if auto_rollback and not self.closed: self._rollback(transaction_future, error) + else: + transaction_future.set_exc_info(sys.exc_info()) return try: