[llvm] r310740 - [opt-viewer] Use Python 3-compatible iteritems

Brian Gesiak via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 11:02:07 PDT 2017


Author: modocache
Date: Fri Aug 11 11:02:07 2017
New Revision: 310740

URL: http://llvm.org/viewvc/llvm-project?rev=310740&view=rev
Log:
[opt-viewer] Use Python 3-compatible iteritems

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

Modified:
    llvm/trunk/tools/opt-viewer/optrecord.py

Modified: llvm/trunk/tools/opt-viewer/optrecord.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-viewer/optrecord.py?rev=310740&r1=310739&r2=310740&view=diff
==============================================================================
--- llvm/trunk/tools/opt-viewer/optrecord.py (original)
+++ llvm/trunk/tools/opt-viewer/optrecord.py Fri Aug 11 11:02:07 2017
@@ -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)
 




More information about the llvm-commits mailing list