summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2011-08-28 21:54:23 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2011-08-28 21:54:23 +0200
commit4afee825db23000b28a226b7b488956d4eb8f708 (patch)
treed39f967e2516e32cd64376620b34ed4916c7d449
parent839327edd3653a83b454293c45616de32c944b01 (diff)
downloadportage-4afee825db23000b28a226b7b488956d4eb8f708.tar.gz
portage-4afee825db23000b28a226b7b488956d4eb8f708.tar.bz2
portage-4afee825db23000b28a226b7b488956d4eb8f708.zip
Fix "ResourceWarning: unclosed file" with Python 3.2.
-rw-r--r--pym/portage/package/ebuild/doebuild.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index aa9218c69..47b4ec400 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1692,14 +1692,17 @@ def _post_src_install_soname_symlinks(mysettings, out):
"build-info", "NEEDED.ELF.2")
try:
- lines = io.open(_unicode_encode(needed_filename,
+ f = io.open(_unicode_encode(needed_filename,
encoding=_encodings['fs'], errors='strict'),
mode='r', encoding=_encodings['repo.content'],
- errors='replace').readlines()
+ errors='replace')
+ lines = f.readlines()
except IOError as e:
if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
return
+ finally:
+ f.close()
libpaths = set(portage.util.getlibpaths(
mysettings["ROOT"], env=mysettings))