[Python-projects] PyLint: Crash when "return" is found at top level

Adrien Di Mascio Adrien.DiMascio at logilab.fr
Fri Nov 24 15:31:36 CET 2006


Hi Marteen,

[Maarten ter Huurne]
> If I run PyLint on the following program:
> ===
> return
> ===
> It crashes like this:
[ ... ]

> 
> Obviously the program is not valid Python, but PyLint does not handle this 
> syntax error well.

I agree pylint should report a bit more nicely the syntax error. 
This is the kind of SyntaxError that are raised at compilation time
and not directly at parse time (it is gramatically correct).
I've made a small fix for that.


The same problem reamins True for code such as ::

    def f():
        if True: yield 1
        else: return 2

Pylint does not crash on this sample, but does not complain either.

Thanks for reporting,
Adrien.

-- 
Adrien Di Mascio                                LOGILAB, Paris (France).
Formations Python,Zope,Debian,Calcul    http://www.logilab.fr/formations
Développement logiciel sur mesure:      http://www.logilab.fr/services
Informatique scientifique:              http://www.logilab.fr/science
Python in Python:     http://codespeak.net/pypy/dist/pypy/doc/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20061124/dc719778/attachment.pgp 


More information about the Python-Projects mailing list