[PATCH] D34670: [opt-viewer] Python 3 support in opt-diff.py

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 23:08:40 PDT 2017


modocache created this revision.
Herald added a subscriber: fhahn.

The `file()` builtin is not available in Python 3; use `open()` instead.
https://docs.python.org/3.0/whatsnew/3.0.html#builtins


https://reviews.llvm.org/D34670

Files:
  utils/opt-viewer/opt-diff.py


Index: utils/opt-viewer/opt-diff.py
===================================================================
--- utils/opt-viewer/opt-diff.py
+++ utils/opt-viewer/opt-diff.py
@@ -66,5 +66,5 @@
         r.Added = True
     for r in removed:
         r.Added = False
-    stream = file(args.output, 'w')
-    yaml.dump_all(added | removed, stream)
+    with open(args.output, 'w') as stream:
+        yaml.dump_all(added | removed, stream)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34670.104096.patch
Type: text/x-patch
Size: 433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170627/78d8427b/attachment.bin>


More information about the llvm-commits mailing list