From 16add820c00996877bd38bc1213d4985c95e8b9e Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Sun, 2 Mar 2008 08:21:48 +0000 Subject: Fix the way memory maps are created to avoid masked_array and memory mapped. --- numpy/core/memmap.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'numpy/core/memmap.py') 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 " \ -- cgit v1.2.1