Properly re-raise exceptions from lock context handler.

This commit is contained in:
Todd Gamblin 2016-08-09 02:06:30 -07:00
parent 0c75c13cc0
commit 9d4a36a62f

View File

@ -213,13 +213,15 @@ def __enter__(self):
return self._as return self._as
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
suppress = False
if self._exit(): if self._exit():
if self._as and hasattr(self._as, '__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: if self._release_fn:
self._release_fn(type, value, traceback) if self._release_fn(type, value, traceback):
if value: suppress = True
raise value return suppress
class ReadTransaction(LockTransaction): class ReadTransaction(LockTransaction):