]> granicus.if.org Git - llvm/commitdiff
[opt-viewer] Use Python 3-compatible iteritems
authorBrian Gesiak <modocache@gmail.com>
Fri, 11 Aug 2017 18:02:07 +0000 (18:02 +0000)
committerBrian Gesiak <modocache@gmail.com>
Fri, 11 Aug 2017 18:02:07 +0000 (18:02 +0000)
Summary:
Replace a usage of a Python 2-specific `dict.iteritems()` with the
Python 3-compatible definition provided at the top of the same file.

Test Plan:
Run `opt-viewer.py` using Python 3 and confirm it no longer encounters a
runtime error when calling `dict.iteritems()`.

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36623

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310740 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt-viewer/optrecord.py

index 2bf0f356d85b19db44c10707e210b7074cb2a268..e84c83e2ce9e53873762cdfbfb09bcb26bef9332 100644 (file)
@@ -80,7 +80,7 @@ class Remark(yaml.YAMLObject):
 
         def _reduce_memory_dict(old_dict):
             new_dict = dict()
-            for (k, v) in old_dict.iteritems():
+            for (k, v) in iteritems(old_dict):
                 if type(k) is str:
                     k = intern(k)