diff options
| author | Konrad Kleine <kkleine@redhat.com> | 2020-05-05 10:29:57 -0400 |
|---|---|---|
| committer | Konrad Kleine <kkleine@redhat.com> | 2020-05-05 17:22:50 -0400 |
| commit | 24b4965ce65b14ead595dcc68add22ba37533207 (patch) | |
| tree | 3c42a7727f62e20b3e259f4a8763497dfa4e3fdc /clang/lib/Frontend/CompilerInvocation.cpp | |
| parent | bf6a26b066382e0f41bf023c781d84061c542307 (diff) | |
| download | llvm-24b4965ce65b14ead595dcc68add22ba37533207.zip llvm-24b4965ce65b14ead595dcc68add22ba37533207.tar.gz llvm-24b4965ce65b14ead595dcc68add22ba37533207.tar.bz2 | |
[clang/clang-tools-extra] Fix BZ44437 - add_new_check.py does not work with Python 3
Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=44437.
Thanks to Arnaud Desitter for providing the patch in the bug report!
A simple example program to reproduce this error is this:
```lang=python
import sys
with open(sys.argv[0], 'r') as f:
lines = f.readlines()
lines = iter(lines)
line = lines.next()
print(line)
```
which will error with this in python python 3:
```
Traceback (most recent call last):
File "./mytest.py", line 8, in <module>
line = lines.next()
AttributeError: 'list_iterator' object has no attribute 'next'
```
Here's the same strategy applied to my test program as applied to the `add_new_check.py` file:
```lang=python
import sys
with open(sys.argv[0], 'r') as f:
lines = f.readlines()
lines = iter(lines)
line = next(lines)
print(line)
```
The built-in function `next()` is new since Python 2.6: https://docs.python.org/2/library/functions.html#next
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79419
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
