Fix NameError

This commit is contained in:
Markus Unterwaditzer 2017-04-27 16:50:13 +02:00
parent 09dacde3f3
commit 83531f95e5

View file

@ -27,11 +27,14 @@ sync_logger = logging.getLogger(__name__)
@contextlib.contextmanager
def _exclusive_transaction(conn):
c = None
try:
c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')
yield c
c.execute('COMMIT')
except BaseException:
if c is None:
raise
_, e, tb = sys.exc_info()
c.execute('ROLLBACK')
raise e.with_traceback(tb)