Patchwork D7970: crecord: fix a concatenation of bytes and str on py3

login
register
mail settings
Submitter phabricator
Date Jan. 22, 2020, 6:04 p.m.
Message ID <differential-rev-PHID-DREV-uttoqmsp6nvxts674ejf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44575/
State Superseded
Headers show

Comments

phabricator - Jan. 22, 2020, 6:04 p.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -24,6 +24,7 @@ 
     encoding,
     error,
     patch as patchmod,
+    pycompat,
     scmutil,
     util,
 )
@@ -1113,7 +1114,7 @@ 
         # strip \n, and convert control characters to ^[char] representation
         text = re.sub(
             br'[\x00-\x08\x0a-\x1f]',
-            lambda m: b'^' + chr(ord(m.group()) + 64),
+            lambda m: b'^' + pycompat.sysbytes(chr(ord(m.group()) + 64)),
             text.strip(b'\n'),
         )