# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 2018-04-11 17:06:16
# Node ID 6ef94f24aa82c0123e34bad66c25f46d28ce1e0f
# Parent  230eb959415002b1daed0025d6d38229b01043d8

py3: make sure we open file in bytes mode

Differential Revision: https://phab.mercurial-scm.org/D3274

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -579,7 +579,7 @@ def importfromfiles(repo, opts, paths, f
         # part of the active rules.
         changed = False
         for p in paths:
-            with util.posixfile(util.expandpath(p)) as fh:
+            with util.posixfile(util.expandpath(p), mode='rb') as fh:
                 raw = fh.read()
 
             iincludes, iexcludes, iprofiles = parseconfig(repo.ui, raw)