aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/__init__.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2020-06-29 20:37:43 +0300
committerJason R. Coombs <jaraco@jaraco.com>2020-07-02 18:02:34 -0400
commit9013321c25606a5cd63271cd029c2539490b16d3 (patch)
treecfacfbcc637edbce92480becbea1ee6e651ecc6f /pkg_resources/__init__.py
parentd9998e6281cbf4bb90cfd8c90e7f34b4ea3a350d (diff)
downloadexternal_python_setuptools-9013321c25606a5cd63271cd029c2539490b16d3.tar.gz
external_python_setuptools-9013321c25606a5cd63271cd029c2539490b16d3.tar.bz2
external_python_setuptools-9013321c25606a5cd63271cd029c2539490b16d3.zip
catch some resource leaks
Diffstat (limited to 'pkg_resources/__init__.py')
-rw-r--r--pkg_resources/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 2e7d5059..61f24461 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1459,7 +1459,8 @@ class NullProvider:
script_filename = self._fn(self.egg_info, script)
namespace['__file__'] = script_filename
if os.path.exists(script_filename):
- source = open(script_filename).read()
+ with open(script_filename) as fid:
+ source = fid.read()
code = compile(source, script_filename, 'exec')
exec(code, namespace, namespace)
else: