[PATCH 06 of 10] py3: byte-stringify ValueError of unescapestr() to reraise as ParseError

Yuya Nishihara yuya at tcha.org
Thu Mar 1 19:26:25 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1519941820 18000
#      Thu Mar 01 17:03:40 2018 -0500
# Node ID 1d65b2d4de6f87f079ae9d29843ee5e8fb675a23
# Parent  3a9920b08348866d5d9f2f85b9d332544686b843
py3: byte-stringify ValueError of unescapestr() to reraise as ParseError

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -22,6 +22,7 @@ from .i18n import _
 from . import (
     encoding,
     error,
+    pycompat,
     util,
 )
 
@@ -192,7 +193,7 @@ def unescapestr(s):
         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):


More information about the Mercurial-devel mailing list