comparison 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
comparison
equal deleted inserted replaced
45722:d502caab76bc 45723:edfc5820aae7
359 flags = 0 359 flags = 0
360 if not casesensitive: 360 if not casesensitive:
361 flags = remod.I 361 flags = remod.I
362 regex = remod.compile(pattern, flags) 362 regex = remod.compile(pattern, flags)
363 except remod.error as e: 363 except remod.error as e:
364 raise error.ParseError(_(b'invalid regular expression: %s') % e) 364 raise error.ParseError(
365 _(b'invalid regular expression: %s') % forcebytestr(e)
366 )
365 return kind, pattern, regex.search 367 return kind, pattern, regex.search
366 elif kind == b'literal': 368 elif kind == b'literal':
367 if casesensitive: 369 if casesensitive:
368 match = pattern.__eq__ 370 match = pattern.__eq__
369 else: 371 else: