summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2008-03-02 08:21:48 +0000
committerTravis Oliphant <oliphant@enthought.com>2008-03-02 08:21:48 +0000
commit16add820c00996877bd38bc1213d4985c95e8b9e (patch)
treec11dfb3132d5f9f6965350a2cb6557e10dbadc7f /numpy/core/memmap.py
parent59a397549b94461a822016347c9636bfb85730b6 (diff)
downloadnumpy-16add820c00996877bd38bc1213d4985c95e8b9e.tar.gz
Fix the way memory maps are created to avoid masked_array and memory mapped.
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r--numpy/core/memmap.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index a7ae3dab8..b31788881 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -199,13 +199,9 @@ class memmap(ndarray):
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 @@ class memmap(ndarray):
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 " \