[SciPy-dev] Update memmap for Python 2.6 and 3?

Sturla Molden sturla at molden.no
Mon Mar 9 09:26:57 EDT 2009


In Python 2.5, mmap always memory maps from the beginning of the file. 
This is a problem on 32 bit systems when working on large data files. In 
Python 2.6, the mmap object takes an offset parameter to solve this. I 
suggest we do something like this in memmap.py:


if float(sys.version[:3]) > 2.5:

     bytes = bytes - offset

     mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=offset)

     self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,
                 offset=0, order=order)

else:

     mm = mmap.mmap(fid.fileno(), bytes, access=acc)

     self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,
                 offset=offset, order=order)


Reagards,
Sturla Molden

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: memmap.py
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20090309/62cc8a1b/attachment.ksh>


More information about the SciPy-Dev mailing list