Patchwork D2072: py3: use pycompat.bytestr to convert _b85chars to bytes

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

Comments

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

REVISION SUMMARY
  The tranformer does append b'' to the value and make that a bytes but bytes in
  Python 3 returns the ascii value on getting characters using indexing.
  Characters of this string are queried using indexing multiple times in the file
  and to support that we use pycompat.bytestr which returns the bytechrs using
  indexing.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/pure/base85.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py
--- a/mercurial/pure/base85.py
+++ b/mercurial/pure/base85.py
@@ -9,8 +9,10 @@ 
 
 import struct
 
-_b85chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
-            "abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"
+from .. import pycompat
+
+_b85chars = pycompat.bytestr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+                             "ghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~")
 _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
 _b85dec = {}