pylint #19607 W0201 being enabled by unrelated comment [open]
Using the following versions: pylint 0.19.0, astng 0.19.3, common 0.46.0 Python 2.5.2 (r252:60911, Jul 22 2009, 15:33:10) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] We have the following situation: $ cat a.py # pylint: disable-msg=W0201,W0232 class A: pass $ cat b.py import a xa = a.A() xa.x = 1 $ pylint -i yes --enable-checker=classes b a $ Which is expected, the disable-msg=W0201 silenced the warning about «Attribute 'x' defined outside __init__» (and the other warning as well). Now we edit b.py to have a comment at the beginning: $ cat b.py # import a xa = a.A() xa.x = 1 $ pylint -i yes --enable-checker=classes b a ************* Module b W0201: 4: Attribute 'x' defined outside __init__ The addition of a simple comment in b.py has re-enabled the W0201 warning. Trying to re-disable it, e.g. via: xa.x = 1 # pylint: disable-msg=W0201 has no effect at all. Note that the other warning (W0232) is not re-enabled by the comment, just W0201. Also note that ordering the arguments matters: $ pylint -i yes --enable-checker=classes a b # no output $ pylint -i yes --enable-checker=classes b a ************* Module b W0201: 4: Attribute 'x' defined outside __init__ I'm not familiar with the internals of pylint, so looking at ClassChecker.leave_class (the only place where W0201 is enabled) doesn't help me. thanks, iustin | |
priority | minor |
---|---|
type | bug |
done in | <not specified> |
closed by | <not specified> |