summaryrefslogtreecommitdiffstats
path: root/pym/portage/elog
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-08-25 14:48:45 -0700
committerZac Medico <zmedico@gentoo.org>2011-08-25 14:50:39 -0700
commit5a24743e55acedcbae06b97401c6e39b0d5faa98 (patch)
tree7b071530472d82551c1085ba10532e63e7f6eeec /pym/portage/elog
parent2aea972aa0c36531445172500ded32d7ddc07762 (diff)
downloadportage-5a24743e55acedcbae06b97401c6e39b0d5faa98.tar.gz
portage-5a24743e55acedcbae06b97401c6e39b0d5faa98.tar.bz2
portage-5a24743e55acedcbae06b97401c6e39b0d5faa98.zip
python3.2 fixes: ResourceWarning: unclosed file
Diffstat (limited to 'pym/portage/elog')
-rw-r--r--pym/portage/elog/messages.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
index 6c1580a37..50e0ab10a 100644
--- a/pym/portage/elog/messages.py
+++ b/pym/portage/elog/messages.py
@@ -43,9 +43,10 @@ def collect_ebuild_messages(path):
logentries[msgfunction] = []
lastmsgtype = None
msgcontent = []
- for l in io.open(_unicode_encode(filename,
+ f = io.open(_unicode_encode(filename,
encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['repo.content'], errors='replace'):
+ mode='r', encoding=_encodings['repo.content'], errors='replace')
+ for l in f:
if not l:
continue
try:
@@ -65,6 +66,7 @@ def collect_ebuild_messages(path):
logentries[msgfunction].append((lastmsgtype, msgcontent))
msgcontent = [msg]
lastmsgtype = msgtype
+ f.close()
if msgcontent:
logentries[msgfunction].append((lastmsgtype, msgcontent))