]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/vfs.py
Add any pending exception to context in all __exit__ methods
[bup.git] / lib / bup / vfs.py
index 09267f4c3e634fa1cf511cdb80cb2c8b6112adb1..f5badf6982fd1f4ed87ceee32bf28dbc6a462af1 100644 (file)
@@ -57,7 +57,7 @@ from time import localtime, strftime
 import re, sys
 
 from bup import git, vint
-from bup.compat import hexstr, range, str_type
+from bup.compat import hexstr, pending_raise, range, str_type
 from bup.git import BUP_CHUNKED, parse_commit, tree_decode
 from bup.helpers import debug2, last
 from bup.io import path_msg
@@ -236,8 +236,8 @@ class _FileReader(object):
     def __enter__(self):
         return self
     def __exit__(self, type, value, traceback):
-        self.close()
-        return False
+        with pending_raise(value, rethrow=False):
+            self.close()
 
 _multiple_slashes_rx = re.compile(br'//+')