Skip to content

Commit

Permalink
Properly re-raise exceptions from lock context handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgamblin committed Aug 9, 2016
1 parent 0c75c13 commit 9d4a36a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/spack/llnl/util/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@ def __enter__(self):
return self._as

def __exit__(self, type, value, traceback):
suppress = False
if self._exit():
if self._as and hasattr(self._as, '__exit__'):
self._as.__exit__(type, value, traceback)
if self._as.__exit__(type, value, traceback):
suppress = True
if self._release_fn:
self._release_fn(type, value, traceback)
if value:
raise value
if self._release_fn(type, value, traceback):
suppress = True
return suppress


class ReadTransaction(LockTransaction):
Expand Down

0 comments on commit 9d4a36a

Please sign in to comment.