summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-09-21 17:21:06 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-09-21 17:21:06 +0000
commit6f149aaca13e603763a9c4a7347d605daaf4829d (patch)
treed52f1ecc083a2e356b4d05be1e16026ce3a09568 /numpy/core/memmap.py
parent1091b67a91c4e87a2304bd203b30800088f0e86e (diff)
downloadnumpy-6f149aaca13e603763a9c4a7347d605daaf4829d.tar.gz
Raise an error if you try to close a memory-map that you don't own.
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