From 83531f95e58666e89e30836a02d25925a9580f0e Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Thu, 27 Apr 2017 16:50:13 +0200 Subject: [PATCH] Fix NameError --- vdirsyncer/sync.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vdirsyncer/sync.py b/vdirsyncer/sync.py index f6b105c..28ae069 100644 --- a/vdirsyncer/sync.py +++ b/vdirsyncer/sync.py @@ -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)