pylint #8881 class member detection false positive [open]

Vincent reported on python-projects :

"""Test for pylint gtk.VBox bug"""

import gtk

DIAL = gtk.MessageDialog(None,

VB = DIAL.vbox
# VB = gtk.VBox()
print "set_spacing" in dir(VB)
print getattr(VB, "set_spacing")
$ pylint
No config file found, using default configuration
************* Module t
E: 12: Class 'vbox' has no 'set_spacing' member

Change VB to not come from MessageDialog().vbox by uncommenting the "VB = gtk.VBox()" line and all is good...

Same problem happens with gtk.Style's "font_desc" attribute or gtk.Image's set_alignment(), set_padding(), gtk.Label's set_use_markup() methods.

Maarteen update

The strange thing is that it says 'vbox' in the error message, not 'VBox', which is the actual class name. I don't know if this is a hint towards the cause of the problem or an unrelated bug in the E1101 check or astng.

(I checked and "DIAL.vbox.__class__ is gtk.VBox" returns True, so it is really the same class.)

The same problem also occurs on the version that I have installed, which is up to date as far as I know

pylint 0.18.0,
astng 0.19.0, common 0.39.0
Python 2.6 (r26:66714, Feb  3 2009, 20:49:49)

syt update

  • why does it talks about "vbox" class (I suppose it actually use the attribute name) ?
  • I guess there is some inference failure, it should then omit the message
  • find why inference fails.
appeared in<not specified>
done in<not specified>
load left0.500
closed by<not specified>