[PATCH] D43165: [lit] Fix problem in how Python versions open files with different encodings

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 14:52:59 PDT 2018


I committed a one line fix before noticing you reverted the change.
Did you happen to check if the fix works for you?


On Mon, Apr 2, 2018 at 2:28 PM, Reid Kleckner via Phabricator
<reviews at reviews.llvm.org> wrote:
> rnk added inline comments.
>
>
> ================
> Comment at: llvm/trunk/utils/lit/lit/TestRunner.py:434
> +        for file in filepaths:
> +            with open(file, 'r', encoding=encoding) as f:
>                  filelines.append(f.readlines())
> ----------------
> I'm getting this Python error now:
> ```
>   File "C:/src/llvm-project/llvm\utils\lit\lit\TestRunner.py", line 545, in executeBuiltinDiff
>     exitCode = compareTwoFiles(filepaths)
>   File "C:/src/llvm-project/llvm\utils\lit\lit\TestRunner.py", line 408, in compareTwoFiles
>     return compareTwoTextFiles(filepaths, encoding)
>   File "C:/src/llvm-project/llvm\utils\lit\lit\TestRunner.py", line 434, in compareTwoTextFiles
>     with open(file, 'r', encoding=encoding) as f:
> TypeError: 'encoding' is an invalid keyword argument for this function
> ```
>
> This doesn't seem Py2/3 compatible. =/
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D43165
>
>
>


More information about the llvm-commits mailing list