[PATCH 1 of 7] py3: have bytes version of os.getenv

Yuya Nishihara yuya at tcha.org
Sun Dec 25 03:01:05 EST 2016


On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1482095138 -19800
> #      Mon Dec 19 02:35:38 2016 +0530
> # Node ID eee84d7c0647a50d4e9828b324e1e37214abd169
> # Parent  e995f00a9e9afda3734e7880df0fc90fd2197a88
> py3: have bytes version of os.getenv
> 
> os.getenv() on python 3 deals with unicodes. If we want to pass bytes. we have
> os.getenvb() which deals with bytes. This patch adds up a pycompat.osgetenv
> which deals with bytes on both python 2 and 3.

You know, os.getenvb() does not exist on Windows. I'd rather replace getenv()
with environ.get() and ban the use of os.getenv() and .setenv().


More information about the Mercurial-devel mailing list