Mercurial > public > mercurial-scm > hg-stable
diff mercurial/url.py @ 30667:69acfd2ca11e
py3: replace os.getenv with pycompat.osgetenv
os.getenv deals with unicodes on Python 3, so we have pycompat.osgetenv to
deal with bytes. This patch replaces occurrences on os.getenv with
pycompat.osgetenv
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Dec 2016 02:54:49 +0530 |
parents | 69459fdf3b1b |
children | a520aefb96f1 |
line wrap: on
line diff
--- a/mercurial/url.py Mon Dec 19 02:35:38 2016 +0530 +++ b/mercurial/url.py Mon Dec 19 02:54:49 2016 +0530 @@ -18,6 +18,7 @@ error, httpconnection as httpconnectionmod, keepalive, + pycompat, sslutil, util, ) @@ -79,7 +80,8 @@ class proxyhandler(urlreq.proxyhandler): def __init__(self, ui): - proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') + proxyurl = (ui.config("http_proxy", "host") or + pycompat.osgetenv('http_proxy')) # XXX proxyauthinfo = None if proxyurl: @@ -97,7 +99,7 @@ no_list.extend([p.lower() for p in ui.configlist("http_proxy", "no")]) no_list.extend([p.strip().lower() for - p in os.getenv("no_proxy", '').split(',') + p in pycompat.osgetenv("no_proxy", '').split(',') if p.strip()]) # "http_proxy.always" config is for running tests on localhost if ui.configbool("http_proxy", "always"):