[pypy-svn] r8580 - pypy/dist/pypy/appspace

ac at codespeak.net ac at codespeak.net
Tue Jan 25 17:59:55 CET 2005


Author: ac
Date: Tue Jan 25 17:59:54 2005
New Revision: 8580

Modified:
   pypy/dist/pypy/appspace/_file.py
Log:
Fix _file.file_.close().

Modified: pypy/dist/pypy/appspace/_file.py
==============================================================================
--- pypy/dist/pypy/appspace/_file.py	(original)
+++ pypy/dist/pypy/appspace/_file.py	Tue Jan 25 17:59:54 2005
@@ -54,6 +54,13 @@
                 "Read and write buffered stream."
                 self.fd = sio.BufferingInputOutputStream(self.fd, bufsize)
 
+    def close(self):
+        """
+        Close the file
+        """
+        self._closed = True
+        getattr(self.fd, 'close', lambda: None)()
+
     def __getattr__(self, attr):
         """
         Handle the readonly attributes and then delegate the other
@@ -64,8 +71,6 @@
             return self.__dict__[attr]
         elif attr in ['mode', 'name', 'closed', 'encoding']:
             return self.__dict__['_' + attr]
-        elif attr == 'close':
-            self._closed = True
                 
         return getattr(self.fd, attr)
 



More information about the Pypy-commit mailing list