summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-17 23:21:19 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-17 23:21:19 -0400
commite06e37c0555e6906aed5e31069e7ef50e402d416 (patch)
tree0f0942b5a807d66e3a77e68ec7c2972b514552ec /setuptools
parent7bbf2df38821a1d524b7755637d860ed27f31fc3 (diff)
downloadpython-setuptools-bitbucket-e06e37c0555e6906aed5e31069e7ef50e402d416.tar.gz
Use context manager for brevity
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/compat.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/setuptools/compat.py b/setuptools/compat.py
index 7397d7fa..09e5af5c 100644
--- a/setuptools/compat.py
+++ b/setuptools/compat.py
@@ -70,11 +70,8 @@ if PY3:
globs = globals()
if locs is None:
locs = globs
- f = open(fn, 'rb')
- try:
+ with open(fn, 'rb') as f:
source = f.read()
- finally:
- f.close()
exec(compile(source, fn, 'exec'), globs, locs)
def reraise(tp, value, tb=None):