From 42c96587b86ba8f551f605086e47a5cd96843a1a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 26 Aug 2011 12:53:55 -0700 Subject: python3.2 fixes: ResourceWarning: unclosed file --- pym/portage/xpak.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pym/portage/xpak.py') diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py index 01cfe7b0a..a05a86009 100644 --- a/pym/portage/xpak.py +++ b/pym/portage/xpak.py @@ -99,7 +99,8 @@ def xpak(rootdir,outfile=None): # CONTENTS is generated during the merge process. continue x = _unicode_encode(x, encoding=_encodings['fs'], errors='strict') - mydata[x] = open(os.path.join(rootdir, x), 'rb').read() + with open(os.path.join(rootdir, x), 'rb') as f: + mydata[x] = f.read() xpak_segment = xpak_mem(mydata) if outfile: -- cgit v1.2.3-1-g7c22