From 55b67e8194b8b4d9e73e27feadbf9af6593e4600 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 11 Jul 2010 18:44:23 +0200 Subject: Fixed python < 2.6 windows specific issue when reading in the index using a memory map. Its totally ridiculous, but fixed --- lib/git/index/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/git/index/base.py') diff --git a/lib/git/index/base.py b/lib/git/index/base.py index 0f02352f..5011a932 100644 --- a/lib/git/index/base.py +++ b/lib/git/index/base.py @@ -124,7 +124,13 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): return # END exception handling - stream = file_contents_ro(fd, stream=True, allow_mmap=True) + # Here it comes: on windows in python 2.5, memory maps aren't closed properly + # Hence we are in trouble if we try to delete a file that is memory mapped, + # which happens during read-tree. + # In this case, we will just read the memory in directly. + # Its insanely bad ... I am disappointed ! + allow_mmap = (os.name != 'nt' or sys.version_info[1] > 5) + stream = file_contents_ro(fd, stream=True, allow_mmap=allow_mmap) try: self._deserialize(stream) -- cgit v1.2.1