# HG changeset patch # User Augie Fackler # Date 2017-05-28 19:47:00 # Node ID 3ce53a49933423c1112748399be68ae014449c32 # Parent d110fb58424c206f38deea4e944121c87cf60d9e dispatch: convert exception payload to bytes more carefully We were previously depending on str() doing something reasonable here, and we can't depend on the objects in question supporting __bytes__, so we work around the lack of direct bytes formatting. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -319,7 +319,8 @@ def _callcatch(ui, func): except error.CommandError as inst: if inst.args[0]: ui.pager('help') - ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) + msgbytes = pycompat.bytestr(inst.args[1]) + ui.warn(_("hg %s: %s\n") % (inst.args[0], msgbytes)) commands.help_(ui, inst.args[0], full=False, command=True) else: ui.pager('help')