# HG changeset patch # User Matt Harbison # Date 2021-03-11 23:33:39 # Node ID 39f23d20ea47234bd2262c41dda0ccd362f7b2c6 # Parent 1099541b64623adfc33a512200bef2cf737d6a32 merge: force an exception message to bytes before printing as a warning Caught by pytype: File "/mnt/c/Users/Matt/hg/mercurial/merge.py", line 1346, in batchremove: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types] Expected: (self, ints: Iterable[int]) Actually passed: (self, ints: str) Differential Revision: https://phab.mercurial-scm.org/D10177 diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -20,6 +20,7 @@ from .node import ( nullrev, ) from .thirdparty import attr +from .utils import stringutil from . import ( copies, encoding, @@ -1341,7 +1342,7 @@ def batchremove(repo, wctx, actions): except OSError as inst: repo.ui.warn( _(b"update failed to remove %s: %s!\n") - % (f, pycompat.bytestr(inst.strerror)) + % (f, stringutil.forcebytestr(inst.strerror)) ) if i == 100: yield i, f