From dec82cb8c449e833e4b9934d56927c2ba682b0d9 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Thu, 16 Feb 2012 20:43:00 +0100 Subject: [PATCH] portage.update.fixdbentries(): Fix ResourceWarnings with Python 3.2. --- pym/portage/update.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/portage/update.py b/pym/portage/update.py index 6d13dfc85..34e466366 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -86,10 +86,11 @@ def fixdbentries(update_iter, dbdir): mydata = {} for myfile in [f for f in os.listdir(dbdir) if f not in ignored_dbentries]: file_path = os.path.join(dbdir, myfile) - mydata[myfile] = io.open(_unicode_encode(file_path, + with io.open(_unicode_encode(file_path, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['repo.content'], - errors='replace').read() + errors='replace') as f: + mydata[myfile] = f.read() updated_items = update_dbentries(update_iter, mydata) for myfile, mycontent in updated_items.items(): file_path = os.path.join(dbdir, myfile) -- 2.26.2