Patchwork [4,of,9] py3: explicitly convert dict.values() to a list on py3

login
register
mail settings
Submitter Pulkit Goyal
Date June 15, 2017, 9:34 p.m.
Message ID <bdab6e36523f1e547f17.1497562486@workspace>
Download mbox | patch
Permalink /patch/21407/
State Accepted
Headers show

Comments

Pulkit Goyal - June 15, 2017, 9:34 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1497556703 -19800
#      Fri Jun 16 01:28:23 2017 +0530
# Node ID bdab6e36523f1e547f1753c67d84b3149fea59fe
# Parent  b48856aec0e1eaf2b2f18e7b1b2aec2ae051d097
py3: explicitly convert dict.values() to a list on py3

dict.values() returns a dict_values() object, so we need to pass it into
list() explicitly to get one.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -561,7 +561,7 @@ 
         raise error.AmbiguousCommand(cmd, clist)
 
     if choice:
-        return choice.values()[0]
+        return list(choice.values())[0]
 
     raise error.UnknownCommand(cmd, allcmds)