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

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


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

Modified:
   trunk/numpy/core/memmap.py
Log:
Raise an error if you try to close a memory-map that you don't own.

Modified: trunk/numpy/core/memmap.py
===================================================================
--- trunk/numpy/core/memmap.py	2007-09-21 17:14:57 UTC (rev 4072)
+++ trunk/numpy/core/memmap.py	2007-09-21 17:21:06 UTC (rev 4073)
@@ -90,8 +90,14 @@
     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



More information about the Numpy-svn mailing list