[PATCH 2 of 4 py3] ui: explicitly open config files in binary mode
Augie Fackler
raf at durin42.com
Wed Nov 9 11:23:39 EST 2016
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1476019069 14400
# Sun Oct 09 09:17:49 2016 -0400
# Node ID 576e4c82886c7e5cf59f7b95b38e0f3c29932581
# Parent 6f2a1367baa59f33fcbc328aea1a637658ce345e
ui: explicitly open config files in binary mode
This has been working mostly accidentally, but now it works explicitly.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -176,7 +176,7 @@ class ui(object):
def readconfig(self, filename, root=None, trust=False,
sections=None, remap=None):
try:
- fp = open(filename)
+ fp = open(filename, u'rb')
except IOError:
if not sections: # ignore unless we were looking for something
return
diff --git a/tests/test-check-py3-commands.t b/tests/test-check-py3-commands.t
--- a/tests/test-check-py3-commands.t
+++ b/tests/test-check-py3-commands.t
@@ -9,6 +9,6 @@ The full traceback is hidden to have a s
> $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
> done
version
- TypeError: startswith first arg must be str or a tuple of str, not bytes
+ TypeError: cannot use a string pattern on a bytes-like object
debuginstall
- TypeError: startswith first arg must be str or a tuple of str, not bytes
+ TypeError: cannot use a string pattern on a bytes-like object
More information about the Mercurial-devel
mailing list