[PATCH] D43165: [lit] Fix problem in how Python versions open files with different encodings
Aaron Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 10 12:38:44 PST 2018
asmith created this revision.
Herald added subscribers: llvm-commits, delcypher.
This issue was found when running the clang unit test on Windows.
Python 3.x cannot open some of the files that the tests are using with a simple open because of their encoding. Python 2.7+ and Python 3.x both support io.open which allows for an encoding to be specified.
Repository:
rL LLVM
https://reviews.llvm.org/D43165
Files:
utils/lit/lit/TestRunner.py
Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -2,6 +2,7 @@
import difflib
import errno
import functools
+import io
import itertools
import getopt
import os, signal, subprocess, sys
@@ -387,7 +388,7 @@
def compareTwoFiles(filepaths):
filelines = []
for file in filepaths:
- with open(file, 'r') as f:
+ with open(file, 'r', encoding="Latin-1") as f:
filelines.append(f.readlines())
exitCode = 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43165.133765.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180210/95a3a3e5/attachment.bin>
More information about the llvm-commits
mailing list