Patchwork [2,of,6,py3] match: make regular expression bytes to prevent TypeError

login
register
mail settings
Submitter Pulkit Goyal
Date March 16, 2017, 4:13 a.m.
Message ID <40704098853f291c0968.1489637597@pulkit-goyal>
Download mbox | patch
Permalink /patch/19375/
State Accepted
Headers show

Comments

Pulkit Goyal - March 16, 2017, 4:13 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1489630967 -19800
#      Thu Mar 16 07:52:47 2017 +0530
# Node ID 40704098853f291c09687cdebd5998ea7e3f01ff
# Parent  1fc3d1f02865b105d25ec6d51148dd7a0745e3cf
match: make regular expression bytes to prevent TypeError

Patch

diff -r 1fc3d1f02865 -r 40704098853f mercurial/match.py
--- a/mercurial/match.py	Thu Mar 16 06:32:33 2017 +0530
+++ b/mercurial/match.py	Thu Mar 16 07:52:47 2017 +0530
@@ -747,7 +747,7 @@ 
         if "#" in line:
             global _commentre
             if not _commentre:
-                _commentre = util.re.compile(r'((?:^|[^\\])(?:\\\\)*)#.*')
+                _commentre = util.re.compile(br'((?:^|[^\\])(?:\\\\)*)#.*')
             # remove comments prefixed by an even number of escapes
             m = _commentre.search(line)
             if m: