Patchwork D2456: py3: convert a map expression into list comprehension

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2018, 12:32 p.m.
Message ID <differential-rev-PHID-DREV-snpdixsv2djxwku4njs3-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28389/
State Superseded
Headers show

Comments

phabricator - Feb. 26, 2018, 12:32 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  map returns a map object on Python 3 and here we wanted a list instead.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -547,7 +547,7 @@ 
     chunkselector = curseschunkselector(headerlist, ui, operation)
     if testfn and os.path.exists(testfn):
         testf = open(testfn)
-        testcommands = map(lambda x: x.rstrip('\n'), testf.readlines())
+        testcommands = [x.rstrip('\n') for x in testf.readlines()]
         testf.close()
         while True:
             if chunkselector.handlekeypressed(testcommands.pop(0), test=True):