Re: [PATCH 1 of 4] py3: make sure encoding.encoding is a bytes variable

2016-12-20 Thread Yuya Nishihara
On Sun, 18 Dec 2016 17:31:31 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1481999125 -19800
> #  Sat Dec 17 23:55:25 2016 +0530
> # Node ID af87471131e2fecc9e6edeb2a5c2e155953da4bb
> # Parent  1c8efe62f1f36fdf1a1bd6fcc5924cf557141d4a
> py3: make sure encoding.encoding is a bytes variable

Looks good. Queued the series, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4] py3: make sure encoding.encoding is a bytes variable

2016-12-18 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1481999125 -19800
#  Sat Dec 17 23:55:25 2016 +0530
# Node ID af87471131e2fecc9e6edeb2a5c2e155953da4bb
# Parent  1c8efe62f1f36fdf1a1bd6fcc5924cf557141d4a
py3: make sure encoding.encoding is a bytes variable

encoding.encoding returns unicodes when locale.getpreferredencoding() is used
to get the preferred encoding. This patch fixes that.

diff -r 1c8efe62f1f3 -r af87471131e2 mercurial/encoding.py
--- a/mercurial/encoding.py Sat Dec 17 20:24:46 2016 +0530
+++ b/mercurial/encoding.py Sat Dec 17 23:55:25 2016 +0530
@@ -93,7 +93,7 @@
 try:
 encoding = environ.get("HGENCODING")
 if not encoding:
-encoding = locale.getpreferredencoding() or 'ascii'
+encoding = locale.getpreferredencoding().encode('ascii') or 'ascii'
 encoding = _encodingfixers.get(encoding, lambda: encoding)()
 except locale.Error:
 encoding = 'ascii'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel