[PATCH 08 of 10] py3: don't crash when re-raising encoding error
Yuya Nishihara
yuya at tcha.org
Thu Mar 1 19:26:27 EST 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1519944992 18000
# Thu Mar 01 17:56:32 2018 -0500
# Node ID 42239a898f18efa768297ab43b016793726834cd
# Parent ebad609de255394be78d234e76a61426776e54ae
py3: don't crash when re-raising encoding error
diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -181,7 +181,8 @@ def fromlocal(s):
return u.encode("utf-8")
except UnicodeDecodeError as inst:
sub = s[max(0, inst.start - 10):inst.start + 10]
- raise error.Abort("decoding near '%s': %s!" % (sub, inst))
+ raise error.Abort("decoding near '%s': %s!"
+ % (sub, pycompat.bytestr(inst)))
except LookupError as k:
raise error.Abort(k, hint="please check your locale settings")
More information about the Mercurial-devel
mailing list