[Python-apps-team] Bug#591676: pylint: please either disable or document dynamic checks
Emile Anclin
emile.anclin at logilab.fr
Mon Nov 22 11:30:29 UTC 2010
On Tuesday 16 November 2010 18:11:48 Jakub Wilk wrote:
> clone 591676 -1
> reassign -1 python-pyicu 1.0-1
> severity -1 wishlist
> retitle -1 please make _icu importable
> retitle 591676 pylint: please either disable or document dynamic checks
> severity 591676 important
> thanks
> Okay, so basically what happens here is:
>
> 1. _icu can be imported only if icu has been imported first. It's
> definitely annoying, but I'd have hard time arguing it's actually a
> bug.
>
> 2. pylint will import a module if and only if it cannot find its
> source. This bad because:
> - It's surprising and undocumented. According to the package
> description, the manual pages, and the FAQ, pylint is a "static code
> checker", so one would expect it won't execute any code it analyses.
> - As seen on the above example, it's a pretty brittle approach.
It's not exactly what happens :
1/ astng parses Python source code
2/ if he finds an import, he will in some cases try to parse the module:
a/ if it is python source, goto 1/
b/ else: import the module as 'living object' and try to get
some information about the module.
The astng.README states :
"Furthermore, astng builds partial trees by inspecting living objects."
Maybe we should mention something like this in Pylint doc?
In our case, we have in icu.py:
>>> from docs import *
and in docs.py:
>>> from _icu import *
As Pylint tries to warn about * import, he will also try to find the
unused imports. Hence astng is going into docs.py, then he finds _icu and
tries to look what is inside...
--
Emile Anclin <emile.anclin at logilab.fr>
http://www.logilab.fr/ http://www.logilab.org/
Informatique scientifique & et gestion de connaissances
More information about the Python-apps-team
mailing list