subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1156347 - /subversion/branches/fs-py/subversion/python/svn/fs.py
Date Wed, 10 Aug 2011 20:17:55 GMT
Author: hwright
Date: Wed Aug 10 20:17:55 2011
New Revision: 1156347

URL: http://svn.apache.org/viewvc?rev=1156347&view=rev
Log:
On the fs-py branch:
Explicitly close files in the Python module, per the Python docs.

* subversion/python/svn/fs.py
  (FS.set_uuid, FS._open_fs): Explicitly close a file, rather than just
    letting it go out of scope.

Modified:
    subversion/branches/fs-py/subversion/python/svn/fs.py

Modified: subversion/branches/fs-py/subversion/python/svn/fs.py
URL: http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/python/svn/fs.py?rev=1156347&r1=1156346&r2=1156347&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/python/svn/fs.py (original)
+++ subversion/branches/fs-py/subversion/python/svn/fs.py Wed Aug 10 20:17:55 2011
@@ -35,7 +35,10 @@ class FS(object):
             uuid_in = uuid.uuid1()
         self.uuid = uuid_in
 
-        open(self.__path_uuid, 'wb').write(str(self.uuid) + '\n')
+        f = open(self.__path_uuid, 'wb')
+        f.write(str(self.uuid) + '\n')
+        f.close()
+
         # We use the permissions of the 'current' file, because the 'uuid'
         # file does not exist during repository creation.
         shutil.copymode(self.__path_current, self.__path_uuid)
@@ -47,8 +50,9 @@ class FS(object):
 
     def _open_fs(self):
         'Open an existing Subvesion filesystem'
-        self.uuid = uuid.UUID(open(
-                                self.__path_uuid, 'rb').readline().rstrip())
+        f = open(self.__path_uuid, 'rb')
+        self.uuid = uuid.UUID(f.readline().rstrip())
+        f.close()
 
 
     def __setup_paths(self):



Mime
View raw message