[Scipy-svn] r4478 - trunk/scipy/io

scipy-svn@scip... scipy-svn@scip...
Tue Jun 24 12:48:36 CDT 2008


Author: rkern
Date: 2008-06-24 12:48:31 -0500 (Tue, 24 Jun 2008)
New Revision: 4478

Modified:
   trunk/scipy/io/array_import.py
Log:
BUG: Allow __del__ to work even when self.file never got constructed. Thanks to Yosef Meller for finding this bug and suggesting the fix. #681

Modified: trunk/scipy/io/array_import.py
===================================================================
--- trunk/scipy/io/array_import.py	2008-06-24 14:23:09 UTC (rev 4477)
+++ trunk/scipy/io/array_import.py	2008-06-24 17:48:31 UTC (rev 4478)
@@ -169,7 +169,7 @@
             return lines[:-1]
 
     def __del__(self):
-        if hasattr(self.file,'close') and self.should_close_file:
+        if hasattr(getattr(self, 'file', None),'close') and self.should_close_file:
             self.file.close()
 
     def __getitem__(self, item):



More information about the Scipy-svn mailing list