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

Maarten ter Huurne maarten.ter.huurne at philips.com
Fri Nov 24 15:01:08 CET 2006


Hi,

If I run PyLint on the following program:
===
return
===
It crashes like this:
===
Traceback (most recent call last):
  File "/usr/bin/pylint", line 4, in ?
    lint.Run(sys.argv[1:])
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 847, in 
__init__
    linter.check(args)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 481, in 
check
    self.check_file(filepath, modname, checkers)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 495, in 
check_file
    astng = self._check_file(filepath, modname, checkers)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 519, in 
_check_file
    self.check_astng_module(astng, checkers)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 577, in 
check_astng_module
    self.astng_events(astng, [checker for checker in checkers
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 594, in 
astng_events
    self.astng_events(child, checkers, _reversed_checkers)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 594, in 
astng_events
    self.astng_events(child, checkers, _reversed_checkers)
  File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 591, in 
astng_events
    checker.visit(astng)
  File "/usr/lib/python2.4/site-packages/logilab/astng/utils.py", line 85, 
in visit
    method(node)
  File "/usr/lib/python2.4/site-packages/pylint/checkers/base.py", line 
392, in visit_return
    self._returns[-1].append(node)
IndexError: list index out of range
===

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

PyLint 0.12.2, astng 0.16.3, common 0.21.0.

Bye,
                Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20061124/c1021dff/attachment.htm 


More information about the Python-Projects mailing list