[PATCH 1 of 6 py3] config: load included config files in binary mode

Augie Fackler raf at durin42.com
Fri Mar 3 19:30:04 UTC 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1488565704 18000
#      Fri Mar 03 13:28:24 2017 -0500
# Node ID 2a02a4ec5147f8bd6685a609ce9499b1266cc6db
# Parent  b4cd912d7704cd976e1bee3a3c927e0e578ec88f
config: load included config files in binary mode

I guess we've been getting lucky that this works in Python 2. This
fixes loading included config files in Python 3 (it used to fail on
the "somebody set up us the BOM" check.)

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -169,5 +169,5 @@ class config(object):
 
     def read(self, path, fp=None, sections=None, remap=None):
         if not fp:
-            fp = util.posixfile(path)
+            fp = util.posixfile(path, r'rb')
         self.parse(path, fp.read(), sections, remap, self.read)


More information about the Mercurial-devel mailing list