diff mercurial/utils/stringutil.py @ 45723:edfc5820aae7

py3: fix stringmatcher() to byte-stringify exception message Spotted while writing regexp variant of stringmatcher().
author Yuya Nishihara <yuya@tcha.org>
date Wed, 14 Oct 2020 22:10:48 +0900
parents d502caab76bc
children ac39a8a214b1
line wrap: on
line diff
--- a/mercurial/utils/stringutil.py	Mon Oct 05 20:53:34 2020 +0900
+++ b/mercurial/utils/stringutil.py	Wed Oct 14 22:10:48 2020 +0900
@@ -361,7 +361,9 @@
                 flags = remod.I
             regex = remod.compile(pattern, flags)
         except remod.error as e:
-            raise error.ParseError(_(b'invalid regular expression: %s') % e)
+            raise error.ParseError(
+                _(b'invalid regular expression: %s') % forcebytestr(e)
+            )
         return kind, pattern, regex.search
     elif kind == b'literal':
         if casesensitive: