Patchwork [11,of,18,helps-py3] webutil: move from dict() construction to {} literals

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2014, 5:40 p.m.
Message ID <52e5aca15f0c220e66b9.1394646045@augie-macbookair>
Download mbox | patch
Permalink /patch/3921/
State Accepted
Commit 0916f829eb8d0b2bf1d5e8037f55c72b964a9006
Headers show

Comments

Augie Fackler - March 12, 2014, 5:40 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1394644804 14400
#      Wed Mar 12 13:20:04 2014 -0400
# Node ID 52e5aca15f0c220e66b97eb3fdd8406b0475ce93
# Parent  d3d3e94e2910b11a32cbe319f22059a77026d0de
webutil: move from dict() construction to {} literals

The latter are both faster and more consistent across Python 2 and 3.

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -146,7 +146,7 @@ 
 def renamelink(fctx):
     r = fctx.renamed()
     if r:
-        return [dict(file=r[0], node=hex(r[1]))]
+        return [{'file': r[0], 'node': hex(r[1])}]
     return []
 
 def nodetagsdict(repo, node):