[PATCH] py3: handle os.environ.get() case in module loader

Yuya Nishihara yuya at tcha.org
Sun Sep 4 06:43:29 EDT 2016

On Sat, 3 Sep 2016 21:14:37 +0530, Pulkit Goyal wrote:
> os.environ for py2 and os.environb for py3, in that case rather having
> util.envrion, it will be better to convert environ to environb using
> the transformer. What say?

We'll need util.environ or pycompat.environ anyway because there is Windows.

  # pycompat.py
  if py2:
      environ = os.environ
          environ = os.environb
      except AttributeError:  # Windows
          environ = wrapper(os.environ)

IMO, pycompat.environ should be read-only to keep the wrapper simple.

More information about the Mercurial-devel mailing list