Patchwork store: py26 compat, don't use a dict comprehension

login
register
mail settings
Submitter Martijn Pieters
Date Oct. 9, 2016, 11:04 a.m.
Message ID <b49b0430810e1c398d05.1476011055@mjpieters-mbp>
Download mbox | patch
Permalink /patch/16980/
State Accepted
Headers show

Comments

Martijn Pieters - Oct. 9, 2016, 11:04 a.m.
# HG changeset patch
# User Martijn Pieters <mjpieters@fb.com>
# Date 1476010702 -7200
#      Sun Oct 09 12:58:22 2016 +0200
# Node ID b49b0430810e1c398d05835dcebd21edf7596639
# Parent  74cd33c9be76c11ba42ba5f2448dcf90419866ba
store: py26 compat, don't use a dict comprehension
Yuya Nishihara - Oct. 9, 2016, 12:43 p.m.
On Sun, 09 Oct 2016 13:04:15 +0200, Martijn Pieters wrote:
> # HG changeset patch
> # User Martijn Pieters <mjpieters@fb.com>
> # Date 1476010702 -7200
> #      Sun Oct 09 12:58:22 2016 +0200
> # Node ID b49b0430810e1c398d05835dcebd21edf7596639
> # Parent  74cd33c9be76c11ba42ba5f2448dcf90419866ba
> store: py26 compat, don't use a dict comprehension

Queued, thanks.
timeless - Oct. 21, 2016, 1:29 p.m.
Martijn Pieters wrote:
> store: py26 compat, don't use a dict comprehension

> -    cmap = {x:x for x in asciistr}

Can we checkcode this?

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -107,7 +107,7 @@ 
         asciistr = map(chr, xrange(127))
     capitals = list(range(ord("A"), ord("Z") + 1))
 
-    cmap = {x:x for x in asciistr}
+    cmap = dict((x, x) for x in asciistr)
     for x in _reserved():
         cmap[xchr(x)] = "~%02x" % x
     for x in capitals + [ord(e)]: