diff --git a/mercurial/error.py b/mercurial/error.py --- a/mercurial/error.py +++ b/mercurial/error.py @@ -215,6 +215,16 @@ class ProgrammingError(Hint, RuntimeError): """Raised if a mercurial (core or extension) developer made a mistake""" + + def __init__(self, msg, *args, **kwargs): + if not isinstance(msg, str): + # This means we're on Python 3, because we got a + # bytes. Turn the message back into a string since this is + # an internal-only error that won't be printed except in a + # stack traces. + msg = msg.decode('utf8') + super(ProgrammingError, self).__init__(msg, *args, **kwargs) + __bytes__ = _tobytes class WdirUnsupported(Exception):