[Python-projects] pylint crashed on unknown decorators
Benjamin Niemann
pink at odahoda.de
Tue Dec 12 11:46:25 CET 2006
Hi,
stubled upon this bug, simplest testcase is:
@fooze
def func():
pass
This results in the traceback:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
847, in __init__
linter.check(args)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
481, in check
self.check_file(filepath, modname, checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
495, in check_file
astng = self._check_file(filepath, modname, checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
519, in _check_file
self.check_astng_module(astng, checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
578, in check_astng_module
if implements(checker, IASTNGChecker)])
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
594, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
594, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
594, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
594, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/lint.py", line
591, in astng_events
checker.visit(astng)
File "/home/users/pink/projects/Valdente/trunk/lib/logilab/astng/utils.py",
line 85, in visit
method(node)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/checkers/variables.py",
line 348, in visit_name
self.add_message('E0602', args=name, node=node)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/checkers/__init__.py",
line 84, in add_message
self.linter.add_message(msg_id, line, node, args)
File "/home/users/pink/projects/Valdente/trunk/lib/pylint/utils.py", line
231, in add_message
line = node.fromlineno#lineno or node.statement().lineno
AttributeError: Name instance has no attribute 'fromlineno'
Perhaps this is the 'XXX' in
def funcdef(self, nodelist):
node = BaseTransformer.funcdef(self, nodelist)
# XXX decorators
return fix_lineno(node, nodelist[-5], nodelist[-3])
in astng/builder.py, line 132, class ASTNGTransformer ???
Another bug, which triggered the bug above, is that pylint does seem not find
a decorator, when it is defined as a member of the class where it is used:
class TC(object):
def deco(func):
return func
@deco
def func(self):
pass
Using astng-0.16.1, common-0.21.0, pylint-0.12.1
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
More information about the Python-Projects
mailing list