py3: byte-stringify ValueError of unescapestr() to reraise as ParseError
authorYuya Nishihara <yuya@tcha.org>
Thu, 01 Mar 2018 17:03:40 -0500
changeset 36576 7840d8bd0558
parent 36575 14bbb54a9c5b
child 36577 086fc71fbb09
py3: byte-stringify ValueError of unescapestr() to reraise as ParseError
mercurial/parser.py
--- a/mercurial/parser.py	Thu Mar 01 16:56:38 2018 -0500
+++ b/mercurial/parser.py	Thu Mar 01 17:03:40 2018 -0500
@@ -22,6 +22,7 @@
 from . import (
     encoding,
     error,
+    pycompat,
     util,
 )
 
@@ -192,7 +193,7 @@
         return util.unescapestr(s)
     except ValueError as e:
         # mangle Python's exception into our format
-        raise error.ParseError(str(e).lower())
+        raise error.ParseError(pycompat.bytestr(e).lower())
 
 def _brepr(obj):
     if isinstance(obj, bytes):