Patchwork [2,of,2] py3: fix the way we produce bytes list in store.py

login
register
mail settings
Submitter Pulkit Goyal
Date Feb. 8, 2017, 5:53 p.m.
Message ID <47e72d467dd8da66092c.1486576426@pulkit-goyal>
Download mbox | patch
Permalink /patch/18354/
State Accepted
Headers show

Comments

Pulkit Goyal - Feb. 8, 2017, 5:53 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1486490137 -19800
#      Tue Feb 07 23:25:37 2017 +0530
# Node ID 47e72d467dd8da66092ca6b6a91235d8432e2dc1
# Parent  61c589c75ebbce625d7056297e122863b68acce9
py3: fix the way we produce bytes list in store.py

bytes(range(127)) does not produce a list whereas we need a list. This patch
fixes that.
Augie Fackler - Feb. 10, 2017, 2:50 a.m.
On Wed, Feb 08, 2017 at 11:23:46PM +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1486490137 -19800
> #      Tue Feb 07 23:25:37 2017 +0530
> # Node ID 47e72d467dd8da66092ca6b6a91235d8432e2dc1
> # Parent  61c589c75ebbce625d7056297e122863b68acce9
> py3: fix the way we produce bytes list in store.py

Queued these, thanks.

> 
> bytes(range(127)) does not produce a list whereas we need a list. This patch
> fixes that.
> 
> diff -r 61c589c75ebb -r 47e72d467dd8 mercurial/store.py
> --- a/mercurial/store.py	Tue Feb 07 22:47:24 2017 +0530
> +++ b/mercurial/store.py	Tue Feb 07 23:25:37 2017 +0530
> @@ -101,7 +101,7 @@
>     e = '_'
>     if pycompat.ispy3:
>         xchr = lambda x: bytes([x])
> -        asciistr = bytes(xrange(127))
> +        asciistr = [bytes(a) for a in range(127)]
>     else:
>         xchr = chr
>         asciistr = map(chr, xrange(127))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff -r 61c589c75ebb -r 47e72d467dd8 mercurial/store.py
--- a/mercurial/store.py	Tue Feb 07 22:47:24 2017 +0530
+++ b/mercurial/store.py	Tue Feb 07 23:25:37 2017 +0530
@@ -101,7 +101,7 @@ 
     e = '_'
     if pycompat.ispy3:
         xchr = lambda x: bytes([x])
-        asciistr = bytes(xrange(127))
+        asciistr = [bytes(a) for a in range(127)]
     else:
         xchr = chr
         asciistr = map(chr, xrange(127))