##// END OF EJS Templates
phabricator: ensure that the return of urlopener.open() is closed...
Matt Harbison -
r41111:9d35ae3d default
parent child Browse files
Show More
@@ -41,6 +41,7 b' Config::'
41
41
42 from __future__ import absolute_import
42 from __future__ import absolute_import
43
43
44 import contextlib
44 import itertools
45 import itertools
45 import json
46 import json
46 import operator
47 import operator
@@ -214,7 +215,8 b' def callconduit(repo, name, params):'
214 else:
215 else:
215 urlopener = urlmod.opener(repo.ui, authinfo)
216 urlopener = urlmod.opener(repo.ui, authinfo)
216 request = util.urlreq.request(url, data=data)
217 request = util.urlreq.request(url, data=data)
217 body = urlopener.open(request).read()
218 with contextlib.closing(urlopener.open(request)) as rsp:
219 body = rsp.read()
218 repo.ui.debug(b'Conduit Response: %s\n' % body)
220 repo.ui.debug(b'Conduit Response: %s\n' % body)
219 parsed = json.loads(body)
221 parsed = json.loads(body)
220 if parsed.get(r'error_code'):
222 if parsed.get(r'error_code'):
General Comments 0
You need to be logged in to leave comments. Login now