mercurial/config.py
changeset 31176 99c5843b228d
parent 31155 8266802f0fa4
child 31306 c920efa9d34b
--- a/mercurial/config.py	Mon Mar 06 23:21:27 2017 -0800
+++ b/mercurial/config.py	Fri Mar 03 12:55:11 2017 -0500
@@ -170,5 +170,8 @@
     def read(self, path, fp=None, sections=None, remap=None):
         if not fp:
             fp = util.posixfile(path, 'rb')
+        assert getattr(fp, 'mode', r'rb') == r'rb', (
+            'config files must be opened in binary mode, got fp=%r mode=%r' % (
+                fp, fp.mode))
         self.parse(path, fp.read(),
                    sections=sections, remap=remap, include=self.read)