Patchwork D2336: py3: make sure regex is bytes in crecord.py

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 7:01 p.m.
Message ID <differential-rev-PHID-DREV-rku5yry62uuvsop26ckj-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28120/
State Superseded
Headers show

Comments

phabricator - Feb. 18, 2018, 7:01 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because we are just adding b''

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2336

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -950,7 +950,7 @@ 
         # preprocess the text, converting tabs to spaces
         text = text.expandtabs(4)
         # strip \n, and convert control characters to ^[char] representation
-        text = re.sub(r'[\x00-\x08\x0a-\x1f]',
+        text = re.sub(br'[\x00-\x08\x0a-\x1f]',
                 lambda m:'^' + chr(ord(m.group()) + 64), text.strip('\n'))
 
         if pair is not None: