py3: add b'' to make sure regex pattern are bytes in hgweb/webutil.py
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 14 Feb 2018 16:06:54 +0530
changeset 36183 44a519ec5077
parent 36182 4f0439981a8a
child 36184 56635c506608
py3: add b'' to make sure regex pattern are bytes in hgweb/webutil.py # skip-blame because we are just adding b'' prefixes Differential Revision: https://phab.mercurial-scm.org/D2260
mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py	Wed Feb 14 15:58:11 2018 +0530
+++ b/mercurial/hgweb/webutil.py	Wed Feb 14 16:06:54 2018 +0530
@@ -626,7 +626,7 @@
         # delimiters. the replace format and flags are optional, but
         # delimiters are required.
         match = re.match(
-            r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$'
+            br'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$'
             % (delim, delim, delim), pattern)
         if not match:
             repo.ui.warn(_("websub: invalid pattern for %s: %s\n")
@@ -634,7 +634,7 @@
             continue
 
         # we need to unescape the delimiter for regexp and format
-        delim_re = re.compile(r'(?<!\\)\\%s' % delim)
+        delim_re = re.compile(br'(?<!\\)\\%s' % delim)
         regexp = delim_re.sub(unesc, match.group(1))
         format = delim_re.sub(unesc, match.group(2))