logilab-astng #37105 Crash on AttributeError: 'NoneType' object has no attribute '_infer_name' [not validated]
When running pylint 0.21.1 in combination with logilab-astng 0.20.1 and logilab-common 0.50.3 on the following code using python 2.5.1: def f(): return def g(p): return p def h(): i = f(); j = g(i); j.a logilab-astng crashes with the following exception: Traceback (most recent call last): File "/tmp/pylint-0.21.1/bin/pylint", line 4, in <module> lint.Run(sys.argv[1:]) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/lint.py", line 848, in __init__ linter.check(args) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/lint.py", line 482, in check self.check_astng_module(astng, walker, rawcheckers) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/lint.py", line 555, in check_astng_module walker.walk(astng) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/utils.py", line 518, in walk self.walk(child) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/utils.py", line 518, in walk self.walk(child) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/utils.py", line 518, in walk self.walk(child) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/utils.py", line 515, in walk cb(astng) File "/tmp/pylint-0.21.1/lib/python2.5/site-packages/pylint/checkers/typecheck.py", line 130, in visit_getattr infered = list(node.expr.infer()) File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 303, in wrapped for res in _func(node, context, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 130, in _infer_stmts for infered in stmt.infer(context): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 303, in wrapped for res in _func(node, context, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 130, in _infer_stmts for infered in stmt.infer(context): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 303, in wrapped for res in _func(node, context, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 327, in wrapper for node in func(*args, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/inference.py", line 209, in infer_callfunc for infered in callee.infer_call_result(self, callcontext): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/scoped_nodes.py", line 591, in infer_call_result for infered in returnnode.value.infer(context): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 303, in wrapped for res in _func(node, context, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 130, in _infer_stmts for infered in stmt.infer(context): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 303, in wrapped for res in _func(node, context, **kwargs): File "/tmp/logilab/lib/python2.5/site-packages/logilab/astng/bases.py", line 128, in _infer_stmts context.lookupname = stmt._infer_name(frame, name) AttributeError: 'NoneType' object has no attribute '_infer_name' | |
priority | important |
---|---|
type | bug |
done in | 0.22.0 |
load | 0.300 |
load left | 0.000 |
closed by | #bdc9ca4f5b05 fix: returning nothing should be infered as Const(None): closes #37105 |
ticket traceability chain
Comments
-
2011/05/30 20:42, written by anon
-
2011/07/21 14:13, written by anon
add commentSimilar crash for pylint 0.23.0 and astng 0.21.1, Python 2.6 (reproduced by `make pylint` in trac trunk r10708):
...
************* Module trac.core
W0404: 42:TracError.__init__: Reimport 'gettext' (imported line 59)
Traceback (most recent call last):
File "C:\Dev\Python265\Scripts\pylint", line 5, in <module>
pkg_resources.run_script('pylint==0.23.0', 'pylint')
File "build\bdist.win32\egg\pkg_resources.py", line 489, in run_script
File "build\bdist.win32\egg\pkg_resources.py", line 1207, in run_script
File "c:\dev\python265\lib\site-packages\pylint-0.23.0-py2.6.egg\EGG-INFO\scripts\pylint", line 4, in <module>
lint.Run(sys.argv[1:])
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\lint.py", line 860, in __init__
linter.check(args)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\lint.py", line 493, in check
self.check_astng_module(astng, walker, rawcheckers)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\lint.py", line 565, in check_astng_module
walker.walk(astng)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 524, in walk
self.walk(child)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 524, in walk
self.walk(child)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 524, in walk
self.walk(child)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 524, in walk
self.walk(child)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 524, in walk
self.walk(child)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\utils.py", line 521, in walk
cb(astng)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\checkers\typecheck.py", line 236, in visit_callfunc
called = safe_infer(node.func)
File "C:\Dev\Python265\lib\site-packages\pylint-0.23.0-py2.6.egg\pylint\checkers\utils.py", line 34, in safe_infer
value = inferit.next()
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 293, in wrapped
for res in _func(node, context, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 317, in wrapper
for node in func(*args, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\inference.py", line 211, in infer_getattr
for owner in self.expr.infer(context):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 293, in wrapped
for res in _func(node, context, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 317, in wrapper
for node in func(*args, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\inference.py", line 211, in infer_getattr
for owner in self.expr.infer(context):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 293, in wrapped
for res in _func(node, context, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 106, in _infer_stmts
for infered in stmt.infer(context):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 293, in wrapped
for res in _func(node, context, **kwargs):
File "C:\Dev\Python265\lib\site-packages\logilab_astng-0.21.1-py2.6.egg\logilab\astng\bases.py", line 104, in _infer_stmts
context.lookupname = stmt._infer_name(frame, name)
AttributeError: 'NoneType' object has no attribute '_infer_name'
Problem fixed with pylint-0.24.0 and logilab-astng-0.22.0, `make pylint` runs through. Thanks!