summaryrefslogtreecommitdiff
path: root/ez_setup.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-15 21:26:21 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-15 21:26:21 -0500
commit5919897c159a1d5b093107dde380f3c1c81f356a (patch)
tree2516f2ece312e4ba552ffeb8be4a6b8503c9ddaf /ez_setup.py
parentd150f9d4b67300a7f4c557a5c95252a947558201 (diff)
downloadpython-setuptools-git-5919897c159a1d5b093107dde380f3c1c81f356a.tar.gz
Use contextlib.closing for the response
Diffstat (limited to 'ez_setup.py')
-rw-r--r--ez_setup.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ez_setup.py b/ez_setup.py
index c0991861..d8c3305e 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -344,7 +344,8 @@ def _resolve_version(version):
if version is not LATEST:
return version
- with urlopen('https://pypi.python.org/pypi/setuptools/json') as resp:
+ resp = urlopen('https://pypi.python.org/pypi/setuptools/json')
+ with contextlib.closing(resp):
charset = resp.info().get_content_charset()
reader = codecs.getreader(charset)
doc = json.load(reader(resp))