[Numpy-discussion] Reminder: code freeze for bet at the end of the WE

Sturla Molden sturla@molden...
Sat Mar 14 13:23:12 CDT 2009


>
> Will memmap be fixed to use offsets correctly before 1.3?

I posted this to scipy-dev (possibly wrong list) on March 9, so I'll
repeat it here: In Python 2.6, mmap has a offset keyword. NumPy's memmap
should use this to allow big files to be memory mapped on 32 bit systems.
Only a minor change is required:

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)


Instead of just:

     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 --------------
A non-text attachment was scrubbed...
Name: memmap.py
Type: text/x-python
Size: 9249 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090314/3ed3403f/attachment-0001.py 


More information about the Numpy-discussion mailing list