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

Sturla Molden sturla@molden...
Mon Mar 9 08:26:57 CDT 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.scipy.org/pipermail/scipy-dev/attachments/20090309/62cc8a1b/attachment-0001.pl 


More information about the Scipy-dev mailing list