[Numpy-svn] r4072 - trunk/numpy/core
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Sep 21 13:15:00 EDT 2007
Author: oliphant
Date: 2007-09-21 12:14:57 -0500 (Fri, 21 Sep 2007)
New Revision: 4072
Modified:
trunk/numpy/core/memmap.py
Log:
Fix memmap passing on it's mmap attribute to views but not closing the file unless it owns the memmap
Modified: trunk/numpy/core/memmap.py
===================================================================
--- trunk/numpy/core/memmap.py 2007-09-21 16:54:38 UTC (rev 4071)
+++ trunk/numpy/core/memmap.py 2007-09-21 17:14:57 UTC (rev 4072)
@@ -80,10 +80,7 @@
if obj is not None:
if not isinstance(obj, memmap):
raise ValueError, "Cannot create a memmap array that way"
- # it would be nice to carry the along the _mmap name
- # but then we might have problems because self could close
- # it while obj is still holding it. So, we don't do
- # anything at this point.
+ self._mmap = obj._mmap
else:
self._mmap = None
@@ -91,9 +88,10 @@
self._mmap.flush()
def close(self):
- self._mmap.close()
+ if (self.base is self._mmap):
+ self._mmap.close()
def __del__(self):
if self._mmap is not None:
self._mmap.flush()
- del self._mmap
+ self.close()
More information about the Numpy-svn
mailing list