##// END OF EJS Templates
py3: use sysstr() to convert ProgrammingError bytes with no unicode error risk...
Yuya Nishihara -
r39632:409c42d6 default
parent child Browse files
Show More
@@ -217,12 +217,10 b' class ProgrammingError(Hint, RuntimeErro'
217 """Raised if a mercurial (core or extension) developer made a mistake"""
217 """Raised if a mercurial (core or extension) developer made a mistake"""
218
218
219 def __init__(self, msg, *args, **kwargs):
219 def __init__(self, msg, *args, **kwargs):
220 if not isinstance(msg, str):
220 # On Python 3, turn the message back into a string since this is
221 # This means we're on Python 3, because we got a
221 # an internal-only error that won't be printed except in a
222 # bytes. Turn the message back into a string since this is
222 # stack traces.
223 # an internal-only error that won't be printed except in a
223 msg = pycompat.sysstr(msg)
224 # stack traces.
225 msg = msg.decode('utf8')
226 super(ProgrammingError, self).__init__(msg, *args, **kwargs)
224 super(ProgrammingError, self).__init__(msg, *args, **kwargs)
227
225
228 __bytes__ = _tobytes
226 __bytes__ = _tobytes
General Comments 0
You need to be logged in to leave comments. Login now