Avoid unnecessary re-opening of index files during pack close.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 24 Sep 2013 22:34:03 +0000 (23:34 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 24 Sep 2013 22:34:03 +0000 (23:34 +0100)
dulwich/pack.py

index 62f1cb2688099923c457976ce72cc6d6b8ae99ba..1350b1d1870a23634fc9f865c98c4a00a3b8c412 100644 (file)
@@ -1802,7 +1802,8 @@ class Pack(object):
     def close(self):
         if self._data is not None:
             self._data.close()
-        self.index.close()
+        if self._idx is not None:
+            self._idx.close()
 
     def __eq__(self, other):
         return type(self) == type(other) and self.index == other.index