[Python-projects] logilab-astng 0.17.1 bug?

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Jul 13 11:05:25 CEST 2007


On Monday 09 July à 15:06, Dave Borowitz wrote:
> Hello again,
> 
> I've found a small issue with astng.
> nodes.py:238, in NodeNG.nodes_of_class, has:
>     for matching in child_node.nodes_of_class(klass):
>         yield matching
> 
> I think what we want is child_node.nodes_of_class(klass, skip_klass). The
> current behavior means that if there is more than one level of recursion, then
> the original skip_klass is not applied. For a concrete example of bad behavior,
> consider:
> 
> def foo():
>   if True:
>     def bar():
>       yield 'something'
> 
> Calling is_generator on the Function node of foo will return True even though
> foo is not a generator, because the inner Function is not properly skipped.

True, I've fixed it in the mercurial repository. Thanks !
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science



More information about the Python-Projects mailing list