summaryrefslogtreecommitdiffstats
path: root/Lib/pkgutil.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-10-29 22:36:53 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-10-29 22:36:53 (GMT)
commit1ab58dfb12dedb7d8a92c8cc222a35bc844e8326 (patch)
treef46fbe58c27be1a48c0ce70126ace51c264fd9d2 /Lib/pkgutil.py
parent5c035c0949bf7f0506191e1a689d52666e186d57 (diff)
downloadcpython-1ab58dfb12dedb7d8a92c8cc222a35bc844e8326.zip
cpython-1ab58dfb12dedb7d8a92c8cc222a35bc844e8326.tar.gz
cpython-1ab58dfb12dedb7d8a92c8cc222a35bc844e8326.tar.bz2
Have pkgutil properly close files.
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r--Lib/pkgutil.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index 0ec6ec5..b486275 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: