Submitter | Pulkit Goyal |
---|---|
Date | Dec. 21, 2016, 10:03 p.m. |
Message ID | <eee84d7c0647a50d4e98.1482357826@pulkit-goyal> |
Download | mbox | patch |
Permalink | /patch/17994/ |
State | Accepted |
Headers | show |
Comments
On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pulkit@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().
On 12/25/2016 09:01 AM, Yuya Nishihara wrote: > On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote: >> # HG changeset patch >> # User Pulkit Goyal <7895pulkit@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(). So, that patch seems broken on windows, should we drop it? Cheers
> On Dec 28, 2016, at 4:54 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > > > > On 12/25/2016 09:01 AM, Yuya Nishihara wrote: >> On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote: >>> # HG changeset patch >>> # User Pulkit Goyal <7895pulkit@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(). > > So, that patch seems broken on windows, should we drop it? It’s only broken for windows-using-python3, so I’d rather we keep it in for now and revisit the problem once we have more things working with unix-using-python3. > > Cheers > > -- > Pierre-Yves David > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On Wed, 28 Dec 2016 17:55:08 -0500, Augie Fackler wrote: > > On Dec 28, 2016, at 4:54 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > > On 12/25/2016 09:01 AM, Yuya Nishihara wrote: > >> On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote: > >>> # HG changeset patch > >>> # User Pulkit Goyal <7895pulkit@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(). > > > > So, that patch seems broken on windows, should we drop it? > > It’s only broken for windows-using-python3, so I’d rather we keep it in for now and revisit the problem once we have more things working with unix-using-python3. I'm okay for either ways. Python3 stuff is far from production level, I guess the python3 test wouldn't pass on Windows anyway.
On Thu, 29 Dec 2016 22:02:52 +0900, Yuya Nishihara wrote: > On Wed, 28 Dec 2016 17:55:08 -0500, Augie Fackler wrote: > > > On Dec 28, 2016, at 4:54 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > > > On 12/25/2016 09:01 AM, Yuya Nishihara wrote: > > >> On Thu, 22 Dec 2016 03:33:46 +0530, Pulkit Goyal wrote: > > >>> # HG changeset patch > > >>> # User Pulkit Goyal <7895pulkit@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(). > > > > > > So, that patch seems broken on windows, should we drop it? > > > > It’s only broken for windows-using-python3, so I’d rather we keep it in for now and revisit the problem once we have more things working with unix-using-python3. > > I'm okay for either ways. Python3 stuff is far from production level, I guess > the python3 test wouldn't pass on Windows anyway. Marked these two patches as "accepted" to pull in new check-code rules.
Patch
diff -r e995f00a9e9a -r eee84d7c0647 mercurial/pycompat.py --- a/mercurial/pycompat.py Mon Dec 19 02:26:41 2016 +0530 +++ b/mercurial/pycompat.py Mon Dec 19 02:35:38 2016 +0530 @@ -45,6 +45,7 @@ ospathsep = os.pathsep.encode('ascii') ossep = os.sep.encode('ascii') osaltsep = os.altsep + osgetenv = os.getenvb if osaltsep: osaltsep = osaltsep.encode('ascii') # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which @@ -156,6 +157,7 @@ sysargv = sys.argv sysplatform = sys.platform getcwd = os.getcwd + osgetenv = os.getenv stringio = io.StringIO empty = _queue.Empty