timothycrosley / deprecated.frosted

A simple program which checks Python source files for errors.
MIT License
249 stars 23 forks source link

print statement as invalid syntax #1

Closed TadLeonard closed 10 years ago

TadLeonard commented 10 years ago

The print statement is flagged as a syntax error. Is frosted only intended for py3k? Do I need to do something with ~/.frosted.cfg?

Three files. The first uses the Python2 print statement. The second uses the Python3 print() function (though it's really just using the statement + object-in-parentheses in my case). The third is a syntax error for any version of Python.

$ tail print*
==> print2.py <==
#!/usr/bin/env python

print "Hello, Frosted"

==> print3.py <==
#!/usr/bin/env python

print("Hello, Frosted")

==> printbroken.py <==
#!/usr/bin/env python

this is not valid Python for any version of the language

They work as expected.

$ ./print2.py 
Hello, Frosted
$ ./print3.py 
Hello, Frosted
$ ./printbroken.py 
  File "./printbroken.py", line 3
    this is not valid Python for any version of the language
                           ^
SyntaxError: invalid syntax

frosted chokes on the first, passes the second, and correctly flags a syntax error for the third file.

$ frosted print2.py 
print2.py:3:21: invalid syntax
print "Hello, Frosted"
                     ^
$ frosted print3.py 
$ frosted printbroken.py 
printbroken.py:3:23: invalid syntax
this is not valid Python for any version of the language
                       ^

pyflakes behaves like I'd expect for each file.

$ pyflakes print2.py 
$ pyflakes print3.py 
$ pyflakes printbroken.py 
printbroken.py:3: invalid syntax
this is not valid Python for any version of the language
                        ^

Hopefully this is enough information.

$ python --version
Python 2.7.1
$ frosted --version
frosted 1.0.0
$ pyflakes --version
0.7.3
timothycrosley commented 10 years ago

Hi @TadLeonard thanks for reporting! Frosted is intended for Python2.6+ and I will make a new release soon to address this issue.

timothycrosley commented 10 years ago

Fixed in hot-fix release 1.0.1, thanks again for reporting!

TadLeonard commented 10 years ago

Looks like it was an easy fix! I guess those __future__ monkey patches are kinda disruptive for a project like this. Thanks for the quick response.

$ frosted print2.py 
$ frosted --version
frosted 1.0.1