aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/pkgutil.py
diff options
context:
space:
mode:
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 0ec6ec52654..b48627565c4 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: