# HG changeset patch # User Yuya Nishihara # Date 1602681048 -32400 # Node ID edfc5820aae700b534189fcbbfb153bf74a20fcd # Parent d502caab76bcfc6fb522927d8efd2b175210cd6a py3: fix stringmatcher() to byte-stringify exception message Spotted while writing regexp variant of stringmatcher(). diff -r d502caab76bc -r edfc5820aae7 mercurial/utils/stringutil.py --- 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: diff -r d502caab76bc -r edfc5820aae7 tests/test-revset.t --- a/tests/test-revset.t Mon Oct 05 20:53:34 2020 +0900 +++ b/tests/test-revset.t Wed Oct 14 22:10:48 2020 +0900 @@ -1448,6 +1448,9 @@ (string '(')) hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \),.*) (re) [255] + $ log 'desc("re:(")' + hg: parse error: invalid regular expression: (unbalanced parenthesis|missing \),.*) (re) + [255] $ try 'grep("\bissue\d+")' (func (symbol 'grep')