[PATCH 3 of 9] py3: replace os.environ with encoding.environ (part 3 of 5)

Yuya Nishihara yuya at tcha.org
Wed Dec 21 10:11:56 EST 2016


On Tue, 20 Dec 2016 19:33:49 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1482006276 -19800
> #      Sun Dec 18 01:54:36 2016 +0530
> # Node ID 9cea8eb14d9e7fbf9be2fa6a67c94e6832d57c11
> # Parent  c1a8b0e2a088a8cd365f7aa6a3f5d609fc57a92f
> py3: replace os.environ with encoding.environ (part 3 of 5)

> --- a/mercurial/url.py	Sun Dec 18 01:46:39 2016 +0530
> +++ b/mercurial/url.py	Sun Dec 18 01:54:36 2016 +0530
> @@ -15,6 +15,7 @@
>  
>  from .i18n import _
>  from . import (
> +    encoding,
>      error,
>      httpconnection as httpconnectionmod,
>      keepalive,
> @@ -118,8 +119,8 @@
>          if ui.config("http_proxy", "host"):
>              for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
>                  try:
> -                    if env in os.environ:
> -                        del os.environ[env]
> +                    if env in encoding.environ:
> +                        del encoding.environ[env]
>                  except OSError:
>                      pass

Here we have to pass new environ dict to urllib2 over the global os.environ
dict. So we'll need to revisit this part later since encoding.environ can be
a read-only copy of os.environ on Python 3.


More information about the Mercurial-devel mailing list