[PATCH] D36623: [opt-viewer] Use Python 3-compatible iteritems

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 10:21:55 PDT 2017


modocache created this revision.

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()`.


https://reviews.llvm.org/D36623

Files:
  tools/opt-viewer/optrecord.py


Index: tools/opt-viewer/optrecord.py
===================================================================
--- tools/opt-viewer/optrecord.py
+++ tools/opt-viewer/optrecord.py
@@ -80,7 +80,7 @@
 
         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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36623.110760.patch
Type: text/x-patch
Size: 438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170811/ef62e853/attachment.bin>


More information about the llvm-commits mailing list