[Numpy-svn] r4841 - trunk/numpy/core
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Mar 2 03:21:50 EST 2008
Author: oliphant
Date: 2008-03-02 02:21:48 -0600 (Sun, 02 Mar 2008)
New Revision: 4841
Modified:
trunk/numpy/core/memmap.py
Log:
Fix the way memory maps are created to avoid masked_array and memory mapped.
Modified: trunk/numpy/core/memmap.py
===================================================================
--- trunk/numpy/core/memmap.py 2008-03-02 08:20:03 UTC (rev 4840)
+++ trunk/numpy/core/memmap.py 2008-03-02 08:21:48 UTC (rev 4841)
@@ -199,13 +199,9 @@
return self
def __array_finalize__(self, obj):
- if obj is not None:
- if hasattr(obj, '_mmap'):
- self._mmap = obj._mmap
- else:
- raise ValueError, 'Cannot create a memmap from object %s'%obj
- else:
- self._mmap = None
+ self._mmap = None
+ if obj is not None and hasattr(obj, '_mmap'):
+ self._mmap = obj._mmap
def flush(self):
"""Flush any changes in the array to the file on disk."""
@@ -219,7 +215,7 @@
def close(self):
"""Close the memmap file."""
- if (self.base is self._mmap):
+ if self.base is self._mmap:
self._mmap.close()
elif self._mmap is not None:
raise ValueError, "Cannot close a memmap that is being used " \
More information about the Numpy-svn
mailing list