From 31067c0ac583af2304ffe52c11df8b14c6162502 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 13 Jun 2019 02:13:23 -0400 Subject: tweak raise/dict syntax for Python 3 compat Use the `raise` statement directly. Switch to using .items() instead of .iteritems(). Python 3 doesn't have .iteritems() as .items() is a generator, and these are small enough that the Python 2 overhead should be negligible. We have to run .keys() through list() in a few places as Python 3 uses a generator and we sometimes want to iterate more than once. That's why we don't change all .keys() or .items() calls -- most are in places where generators are fine. Bug: https://crbug.com/gerrit/10418 Change-Id: I469899d9b77ffd77ccabb831bc4b217407fefe6f --- subcmds/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'subcmds/info.py') diff --git a/subcmds/info.py b/subcmds/info.py index f2827b34..2fff3acc 100644 --- a/subcmds/info.py +++ b/subcmds/info.py @@ -99,7 +99,7 @@ class Info(PagedCommand): self.headtext(p.revisionExpr) self.out.nl() - localBranches = p.GetBranches().keys() + localBranches = list(p.GetBranches().keys()) self.heading("Local Branches: ") self.redtext(str(len(localBranches))) if len(localBranches) > 0: -- cgit v1.2.3-54-g00ecf