Rev 5238: (lifeless) Explicitly close the file handle in WT.get_file_text. (Tim Penhey) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue May 18 03:46:17 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5238 [merge]
revision-id: pqm at pqm.ubuntu.com-20100518024615-dmqzcnicw5p48k53
parent: pqm at pqm.ubuntu.com-20100518012904-kqnsvviyl17w8e4t
parent: tim.penhey at canonical.com-20100517100405-jtnwyv3szfpcp9w8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-05-18 03:46:15 +0100
message:
  (lifeless) Explicitly close the file handle in WT.get_file_text. (Tim Penhey)
modified:
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2010-05-11 08:44:59 +0000
+++ b/bzrlib/workingtree.py	2010-05-17 10:04:05 +0000
@@ -463,7 +463,11 @@
         return (file_obj, stat_value)
 
     def get_file_text(self, file_id, path=None, filtered=True):
-        return self.get_file(file_id, path=path, filtered=filtered).read()
+        my_file = self.get_file(file_id, path=path, filtered=filtered)
+        try:
+            return my_file.read()
+        finally:
+            my_file.close()
 
     def get_file_byname(self, filename, filtered=True):
         path = self.abspath(filename)




More information about the bazaar-commits mailing list