[PATCH 6 of 7] py3: slice over bytes to prevent getting ascii values

Pulkit Goyal 7895pulkit at gmail.com
Thu May 4 15:51:41 EDT 2017


On Thu, May 4, 2017 at 7:46 AM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Wed, 03 May 2017 15:29:25 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pulkit at gmail.com>
> > # Date 1493320932 -19800
> > #      Fri Apr 28 00:52:12 2017 +0530
> > # Node ID 07bd56e106d472c526d99caf3154c2d2727f8d79
> > # Parent  4b5015610049afd91ae99357657a6fad7c234547
> > py3: slice over bytes to prevent getting ascii values
>
> Can you check if bytestr is usable?
>

​Yes, bytestr is pretty much usable.​


>
> > diff -r 4b5015610049 -r 07bd56e106d4 mercurial/changelog.py
> > --- a/mercurial/changelog.py  Fri Apr 21 00:53:38 2017 +0530
> > +++ b/mercurial/changelog.py  Fri Apr 28 00:52:12 2017 +0530
> > @@ -190,7 +190,7 @@
> >
> >          # The list of files may be empty. Which means nl3 is the first
> of the
> >          # double newline that precedes the description.
> > -        if text[nl3 + 1] == '\n':
> > +        if text[nl3 + 1:nl3 + 2] == '\n':
>
> I think this is simple enough to not use bytestr helper.
>
> > --- a/mercurial/templater.py  Fri Apr 21 00:53:38 2017 +0530
> > +++ b/mercurial/templater.py  Fri Apr 28 00:52:12 2017 +0530
> > @@ -54,7 +54,7 @@
> >      with term if specified"""
> >      pos = start
> >      while pos < end:
> > -        c = program[pos]
> > +        c = program[pos:pos + 1]
>
> but here we have too many [x:x + 1] so we should use bytestr instead.
>

​I will send a V2 using bytestr at some places and slicing at some places.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170505/2b9b9c6b/attachment.html>


More information about the Mercurial-devel mailing list