[llvm] r306423 - [opt-viewer] Python 3 support in opt-diff.py

Brian Gesiak via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 09:46:50 PDT 2017


Author: modocache
Date: Tue Jun 27 09:46:50 2017
New Revision: 306423

URL: http://llvm.org/viewvc/llvm-project?rev=306423&view=rev
Log:
[opt-viewer] Python 3 support in opt-diff.py

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

Reviewers: anemet, davidxl, davide

Reviewed By: davide

Subscribers: davide, fhahn, llvm-commits

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

Modified:
    llvm/trunk/utils/opt-viewer/opt-diff.py

Modified: llvm/trunk/utils/opt-viewer/opt-diff.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/opt-viewer/opt-diff.py?rev=306423&r1=306422&r2=306423&view=diff
==============================================================================
--- llvm/trunk/utils/opt-viewer/opt-diff.py (original)
+++ llvm/trunk/utils/opt-viewer/opt-diff.py Tue Jun 27 09:46:50 2017
@@ -66,5 +66,5 @@ if __name__ == '__main__':
         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)




More information about the llvm-commits mailing list