[Python-projects] PyLint crash
Maarten ter Huurne
maarten.ter.huurne at philips.com
Mon Mar 5 21:18:39 CET 2007
Hi,
If I feed the following program to PyLint:
===
def f(g = lambda: None):
g().x
===
It crashes on the statement "i = self.argnames.index(argname)" in ASTNG,
because "argname" does not exist in "self.argnames".
This error happens with rpython disabled, but it is very similar to three
other errors I got with rpython enabled, so I think that enabling rpython
increases the chance of triggering this bug because of the additional type
information that becomes available.
Here is the full log:
===
$ pylint --version
No config file found, using default configuration
pylint 0.13.1,
astng 0.17.0, common 0.21.2
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]
$ pylint -rn testcase2.py
No config file found, using default configuration
************* Module testcase2
W: 2: Found indentation with tabs instead of spaces
C: 1: Missing docstring
C: 1:f: Invalid name "f" (should match [a-z_][a-z0-9_]{2,30}$)
C: 1:f: Missing docstring
C: 1:f: Invalid name "g" (should match [a-z_][a-z0-9_]{2,30}$)
W: 2:f: Statement seems to have no effect
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 890, in
__init__
linter.check(args)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 496, in
check
self.check_file(filepath, modname, checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 513, in
check_file
astng = self._check_file(filepath, modname, checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 537, in
_check_file
if not self.check_astng_module(astng, checkers):
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 598, in
check_astng_module
self.astng_events(astng, [checker for checker in checkers
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 616, in
astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 616, in
astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 616, in
astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 616, in
astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 616, in
astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 613, in
astng_events
checker.visit(astng)
File "/usr/lib/python2.4/site-packages/logilab/astng/utils.py", line 84,
in visit
method(node)
File "/usr/lib/python2.4/site-packages/pylint/checkers/typecheck.py",
line 93, in visit_getattr
infered = list(node.expr.infer())
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
45, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
269, in infer_callfunc
for callee in self.node.infer(context):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
45, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/lib/python2.4/site-packages/logilab/astng/__init__.py", line
122, in _infer_stmts
for infered in stmt.infer(context):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
45, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
194, in infer_function
for infered in context.callcontext.infer_argument(self, name,
context):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
45, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
194, in infer_function
for infered in context.callcontext.infer_argument(self, name,
context):
File "/usr/lib/python2.4/site-packages/logilab/astng/inference.py", line
171, in infer_argument
mularg = funcnode.mularg_class(name)
File "/usr/lib/python2.4/site-packages/logilab/astng/scoped_nodes.py",
line 391, in mularg_class
i = self.argnames.index(argname)
ValueError: list.index(x): x not in list
===
Bye,
Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20070305/6d4e25f6/attachment.htm
More information about the Python-Projects
mailing list