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

Augie Fackler raf at durin42.com
Sun Oct 9 10:16:50 EDT 2016


# 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')
         except IOError:
             if not sections: # ignore unless we were looking for something
                 return


More information about the Mercurial-devel mailing list