summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r--numpy/core/memmap.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index 3650091bc..7063cf661 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -90,8 +90,14 @@ class memmap(ndarray):
def close(self):
if (self.base is self._mmap):
self._mmap.close()
+ else:
+ raise ValueError, "Cannot close a memmap that is being used " \
+ "by another object."
def __del__(self):
if self._mmap is not None:
self._mmap.flush()
- self.close()
+ try:
+ self.close()
+ except:
+ pass