Have pkgutil properly close files.

This commit is contained in:
Brett Cannon 2010-10-29 22:36:53 +00:00
parent 5c035c0949
commit 1ab58dfb12
1 changed files with 2 additions and 1 deletions

View File

@ -241,7 +241,8 @@ class ImpLoader:
return mod return mod
def get_data(self, pathname): def get_data(self, pathname):
return open(pathname, "rb").read() with open(pathname, "rb") as file:
return file.read()
def _reopen(self): def _reopen(self):
if self.file and self.file.closed: if self.file and self.file.closed: