F812 fails under Python 3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Under both Python 2 and 3, I expect the F812 warning to be reported.
I originally found this via TravisCI testing, see https:/
I am using pyflakes 1.5.0 installed with pip under macOS using either Apple provided Python 2.7, or a self-compiled Python 3.4.
Test script and its output:
```
$ cat test_F812.py
x = 3
y = [chr(x + 32) for x in range(3)]
print("The value of x should be 2 or 3 (matching your version of Python):")
print(x)
$ python test_F812.py
The value of x should be 2 or 3 (matching your version of Python):
2
$ python3 test_F812.py
The value of x should be 2 or 3 (matching your version of Python):
3
```
Expected output as seen on Python 2.7,
```
$ /usr/local/
1.5.0
$ /usr/local/
test_F812.py:3: list comprehension redefines 'x' from line 1
Return code 1
```
or to show explicitly this is under Python 2,
```
$ python --version
Python 2.7.10
$ python -m pyflakes --version
1.5.0
$ python -m pyflakes test_F812.py ; echo "Return code $?"
test_F812.py:3: list comprehension redefines 'x' from line 1
Return code 1
```
Problem output as seen on Python 3.4,
```
$ pyflakes --version
1.5.0
$ pyflakes test_F812.py ; echo "Return code $?"
Return code 0
```
or to show explicitly this is under Python 3,
```
$ python3 --version
Python 3.4.1
$ python3 -m pyflakes --version
1.5.0
$ python3 -m pyflakes test_F812.py ; echo "Return code $?"
Return code 0
```
This is the intended behaviour for PyFlakes. It has different errors that it reports based on which version of Python it's run under.