[Numpy-svn] r4074 - trunk/numpy/core

numpy-svn@scip... numpy-svn@scip...
Fri Sep 21 12:32:32 CDT 2007


Author: oliphant
Date: 2007-09-21 12:32:21 -0500 (Fri, 21 Sep 2007)
New Revision: 4074

Modified:
   trunk/numpy/core/memmap.py
Log:
A little refactoring of memmap

Modified: trunk/numpy/core/memmap.py
===================================================================
--- trunk/numpy/core/memmap.py	2007-09-21 17:21:06 UTC (rev 4073)
+++ trunk/numpy/core/memmap.py	2007-09-21 17:32:21 UTC (rev 4074)
@@ -85,19 +85,20 @@
             self._mmap = None
 
     def sync(self):
-        self._mmap.flush()
+        if self._mmap is not None:
+            self._mmap.flush()
 
     def close(self):
         if (self.base is self._mmap):
             self._mmap.close()
-        else:
+        elif self._mmap is not None:
             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()
-            try:
-                self.close()
-            except:
-                pass
+        self.sync()
+        try:
+            self.close()
+        except ValueError:
+            pass            
+        



More information about the Numpy-svn mailing list