On 08 mars 16:02, nikola kramaric wrote:
> Hi,

Hi,
 
> I have written some code to fix bug #5975. The idea is that abstract classes
> should not have to implement methods of parent classes. I added a check in
> the _check_bases_classes(self, node) function in the classes.py module to
> test if the provided class is abstract, if so, do not check that it
> implements functions from a parent class.
> 
>      # check if this class abstract
>         if class_is_abstract(node):
>             return
> 
> and a function class_is_abstract:
> 
> def class_is_abstract(node):
>     """return true if the given class node should be considered as an
> abstract
>     class
>     """
>     for method in node.methods():
>         owner = method.parent.frame()
>         if owner is node:
>             if method.is_abstract(pass_is_abstract=False):
>                 return True
> 
>     return False
> 
> Does this seem like a reasonable fix?

yup, sounds good. Could you provides a full patch including test demonstrating
the pb is fixed as well? This is simple: put a python module in test/input and
expected message in test/messages. Run "python test_func.py" to check your
test pass and you've not broken some others.
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to