diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2009-04-13 16:17:21 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2009-04-13 16:17:21 +0000 |
commit | 48d27be1a9353ed49a8afc6ac855eb08dd993abe (patch) | |
tree | 05c5609ad81cc1c61f44ebff0b35cf7e35f89156 /numpy/core/memmap.py | |
parent | 430647c0dbdde130f0747c1fa2b1939d33e8f9b6 (diff) | |
download | numpy-48d27be1a9353ed49a8afc6ac855eb08dd993abe.tar.gz |
Small cleanup of memmap code.
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r-- | numpy/core/memmap.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 5c8542479..65f4938fe 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -226,11 +226,10 @@ class memmap(ndarray): if sys.version_info[:2] >= (2,6): # The offset keyword in mmap.mmap needs Python >= 2.6 - blocks = offset // mmap.ALLOCATIONGRANULARITY - aligned_offset = blocks * mmap.ALLOCATIONGRANULARITY - bytes = bytes - aligned_offset - offset = offset - aligned_offset - mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=aligned_offset) + start = offset - offset % mmap.ALLOCATIONGRANULARITY + bytes -= start + offset -= start + mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start) else: mm = mmap.mmap(fid.fileno(), bytes, access=acc) |