Patchwork [3,of,5,py3] config: open config files as binary explicitly all the time

login
register
mail settings
Submitter Augie Fackler
Date Nov. 10, 2016, 10:10 p.m.
Message ID <86c54d5610fc355ba0a6.1478815841@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17464/
State Changes Requested
Headers show

Comments

Augie Fackler - Nov. 10, 2016, 10:10 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1476019794 14400
#      Sun Oct 09 09:29:54 2016 -0400
# Node ID 86c54d5610fc355ba0a68b51319740a1a8b4a975
# Parent  7ae2625413fd48679660eeb6500b41fd2564d570
config: open config files as binary explicitly all the time

We had been getting lucky that on posix-like systems the default for
files in Python 2 is binary IO, but now we're explicitly using binary
IO all the time.

Patch

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)