comparison mercurial/encoding.py @ 45681:a736ab681b78

errors: stop passing non-strings to Abort's constructor The next patch will change `Abort`'s constructor and `__bytes__` functions and they will start assuming that the first argument is the messages as `bytes`. Differential Revision: https://phab.mercurial-scm.org/D9178
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 08 Oct 2020 15:35:44 -0700
parents 9d2b2df2c2ba
children 89a2afe31e82
comparison
equal deleted inserted replaced
45680:bb1a988ef4a5 45681:a736ab681b78
205 except UnicodeDecodeError: 205 except UnicodeDecodeError:
206 u = s.decode("utf-8", "replace") # last ditch 206 u = s.decode("utf-8", "replace") # last ditch
207 # can't round-trip 207 # can't round-trip
208 return u.encode(_sysstr(encoding), "replace") 208 return u.encode(_sysstr(encoding), "replace")
209 except LookupError as k: 209 except LookupError as k:
210 raise error.Abort(k, hint=b"please check your locale settings") 210 raise error.Abort(
211 pycompat.bytestr(k), hint=b"please check your locale settings"
212 )
211 213
212 214
213 def fromlocal(s): 215 def fromlocal(s):
214 # type: (bytes) -> bytes 216 # type: (bytes) -> bytes
215 """ 217 """