From 0c9eaa52472e2d64a79467025115152fb0167632 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Thu, 3 Jan 2019 14:12:23 +0000 Subject: [PATCH] Python compat - iteritems() vs. items() Always use `items()` and introduce extra `list(...)` call when needed. Differential Revision: https://reviews.llvm.org/D56257 llvm-svn: 350312 --- test/tools/llvm-readobj/Inputs/relocs.py | 2 +- utils/Reviewing/find_interesting_reviews.py | 4 ++-- utils/docker/scripts/llvm_checksum/llvm_checksum.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tools/llvm-readobj/Inputs/relocs.py b/test/tools/llvm-readobj/Inputs/relocs.py index 7c40233ce45..8e621cef5cd 100644 --- a/test/tools/llvm-readobj/Inputs/relocs.py +++ b/test/tools/llvm-readobj/Inputs/relocs.py @@ -75,7 +75,7 @@ class EnumType(type): def makeKey(item): return (item[1], item[0]) e = [] - for pair in sorted(self._nameMap.iteritems(), key=makeKey): + for pair in sorted(self._nameMap.items(), key=makeKey): e.append(pair) return e diff --git a/utils/Reviewing/find_interesting_reviews.py b/utils/Reviewing/find_interesting_reviews.py index a9ab3a3ec85..7bfbec8cfde 100644 --- a/utils/Reviewing/find_interesting_reviews.py +++ b/utils/Reviewing/find_interesting_reviews.py @@ -52,10 +52,10 @@ class PhabObjectCache: return self.id2PhabObjects[id] def get_ids_in_cache(self): - return self.id2PhabObjects.keys() + return list(self.id2PhabObjects.keys()) def get_objects(self): - return self.id2PhabObjects.values() + return list(self.id2PhabObjects.values()) DEFAULT_DIRECTORY = "PhabObjectCache" diff --git a/utils/docker/scripts/llvm_checksum/llvm_checksum.py b/utils/docker/scripts/llvm_checksum/llvm_checksum.py index 584efa2598b..f554d920104 100755 --- a/utils/docker/scripts/llvm_checksum/llvm_checksum.py +++ b/utils/docker/scripts/llvm_checksum/llvm_checksum.py @@ -183,7 +183,7 @@ def ValidateChecksums(reference_checksums, if len(new_checksums) != len(reference_checksums): return False - for proj, checksum in new_checksums.iteritems(): + for proj, checksum in new_checksums.items(): # We never computed a checksum for this project. if proj not in reference_checksums: return False