dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00365
[PATCH 3/6] pack.FilePackIndex: close mmap object
_load_file_contents may return a mmap object, so self._contents could be
mmap-ed. Close it if so.
Note: we use hasattr() instead of isinstance() for pre-Python 2.6
compatibility (mmap became a class in Python 2.6).
---
dulwich/pack.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/dulwich/pack.py b/dulwich/pack.py
index 0654e67..8bb4413 100644
--- a/dulwich/pack.py
+++ b/dulwich/pack.py
@@ -360,6 +360,8 @@ class FilePackIndex(PackIndex):
def close(self):
self._file.close()
+ if hasattr(self._contents, "close"):
+ self._contents.close()
def __len__(self):
"""Return the number of entries in this pack index."""
--
1.7.3.2.msysgit.0
Follow ups
References