[PATCH 08 of 11 py3] ui: explicitly open config files in binary mode

Yuya Nishihara yuya at tcha.org
Mon Oct 10 15:47:24 EDT 2016


On Sun, 09 Oct 2016 10:16:50 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1476019069 14400
> #      Sun Oct 09 09:17:49 2016 -0400
> # Node ID 2f926a3f2409af24260f826ca1823c564ffea03e
> # Parent  f2359d649c2164ba5efb3c202850064c7d777848
> 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')

Do we still need this after 1f01e3e33336 "py3: a second argument to open
can't be bytes" ?


More information about the Mercurial-devel mailing list