changeset 36183:44a519ec5077

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
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 14 Feb 2018 16:06:54 +0530
parents 4f0439981a8a
children 56635c506608
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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))