diff options
author | Brett Cannon <bcannon@gmail.com> | 2010-10-29 22:36:53 +0000 |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2010-10-29 22:36:53 +0000 |
commit | 1ab58dfb12dedb7d8a92c8cc222a35bc844e8326 (patch) | |
tree | f46fbe58c27be1a48c0ce70126ace51c264fd9d2 /Lib/pkgutil.py | |
parent | 5c035c0949bf7f0506191e1a689d52666e186d57 (diff) | |
download | cpython-git-1ab58dfb12dedb7d8a92c8cc222a35bc844e8326.tar.gz |
Have pkgutil properly close files.
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r-- | Lib/pkgutil.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index 0ec6ec5265..b48627565c 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -241,7 +241,8 @@ class ImpLoader: return mod def get_data(self, pathname): - return open(pathname, "rb").read() + with open(pathname, "rb") as file: + return file.read() def _reopen(self): if self.file and self.file.closed: |