From a12c63842b28e29f3bc6718e6d940d5b697f010f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 24 Aug 2011 19:25:59 -0700 Subject: python3.2 fixes: ResourceWarning: unclosed file --- pym/portage/news.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pym/portage/news.py') diff --git a/pym/portage/news.py b/pym/portage/news.py index 866e5b025..031e98c8c 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -250,10 +250,11 @@ class NewsItem(object): return self._valid def parse(self): - lines = io.open(_unicode_encode(self.path, + f = io.open(_unicode_encode(self.path, encoding=_encodings['fs'], errors='strict'), - mode='r', encoding=_encodings['content'], errors='replace' - ).readlines() + mode='r', encoding=_encodings['content'], errors='replace') + lines = f.readlines() + f.close() self.restrictions = {} invalids = [] for i, line in enumerate(lines): -- cgit v1.2.3-1-g7c22