changeset 36547:7840d8bd0558

py3: byte-stringify ValueError of unescapestr() to reraise as ParseError
author Yuya Nishihara <yuya@tcha.org>
date Thu, 01 Mar 2018 17:03:40 -0500
parents 14bbb54a9c5b
children 086fc71fbb09
files mercurial/parser.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):