[Python-projects] astng crashes on yield expression

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Mar 27 09:56:50 CET 2009


Le Thursday 26 March 2009 19:49:22 Huurne, Maarten ter, vous avez écrit :
> Hi,
>
> Another false positive:
> ===
> def f():
>                 x = 12
>                 yield x
> ===
> E0601:  3:f: Using variable 'x' before assignment
>
> This false positive disappears when I revert the changes I made in
> "nodes.py", but then the crashes return on other parts of the code. So I'll
> continue looking for a better workaround. Any suggestions how to approach
> this would be most welcome.

I've summarized your reports on http://www.logilab.net/org/ticket/8771

imo the right direction is in your first attempt, eg not considering yield as 
a statement, it should be wrapped in an Assign or Discard statement node.

Some stuff (ass_type/assigned_stmts) should also be added to support assigment 
of yield expression. 
And finally pylint updated to avoid false positives.
-- 
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