py3: make sure encoding.encoding is a bytes variable
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 17 Dec 2016 23:55:25 +0530
changeset 30622 ce36fa9b140c
parent 30621 d7875bfbfccb
child 30623 c6026c20a3ce
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.
mercurial/encoding.py
--- a/mercurial/encoding.py	Mon Dec 19 22:15:00 2016 +0000
+++ 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'