from
Enrico Hartung <enrico at iptel dot org>
to
Python-Projects <python-projects at lists dot logilab dot org>
subject
[Python-projects] pylint and interfaces
date
Hi,2005/07/11 15:28
I had a problem with interfaces and pylint. The following scenario
leaded to an AttributeError:
(AttributeError: Module instance has no attribute 'get_method')
class ITest:
"interface"
def test1(a, b):
pass
def test2(c, d):
pass
class Test(ITest):
"implementing interface ITest"
def __init__:
pass
def test1(a, b):
pass
def test2(c, d):
pass
I found out that pylint trys to invoke __init__ in the interface even it
does not exist. I think that has something to do with that the default
value for method in _ancestors_to_call() (classes.py) is "__init__"...
I fixed this "bug" by adding a catch for AttributeError in classes.py on
line 451:
def _ancestors_to_call(self, node, klass_node, method='__init__'):
.
.
.
else:
try:
baseastng.get_method(method)
to_call[base] = 1
except (astng.NotFoundError, AttributeError):
continue
return to_call, unresolved
regards
Enrico Hartung
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects
