diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2433,5 +2433,5 @@ class arbitraryfilectx(object): def write(self, data, flags, **kwargs): assert not flags - with open(self._path, "w") as f: + with open(self._path, "wb") as f: f.write(data)