Browse Source

Fix offset argument to mmap on python 2.6.

Jelmer Vernooij 16 năm trước cách đây
mục cha
commit
46e46e15ef
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      dulwich/pack.py

+ 3 - 1
dulwich/pack.py

@@ -108,7 +108,9 @@ def simple_mmap(f, offset, size, access=mmap.ACCESS_READ):
     :return: MMAP'd area.
     """
     if supports_mmap_offset:
-        return mmap.mmap(f.fileno(), size, access=access, offset=offset), 0
+        return (mmap.mmap(f.fileno(), size, access=access, 
+                    offset=int(offset / mmap.ALLOCATIONGRANULARITY)), 
+                (offset % mmap.ALLOCATIONGRANULARITY))
     else:
         mem = mmap.mmap(f.fileno(), size+offset, access=access)
         return mem, offset