After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 470718 - propertyhelper don't let you subclass
propertyhelper don't let you subclass
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-27 15:04 UTC by Marco Giusti
Modified: 2007-08-27 16:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a test (449 bytes, text/x-python)
2007-08-27 15:07 UTC, Marco Giusti
Details

Description Marco Giusti 2007-08-27 15:04:53 UTC
GobjectMeta check for do_(get|set)_property. the base class does not have such methods so the metaclass creates they. then the subclass inherits both methods and the meta class check for prop.getter which doesn't exists. this is because how metaclasses work: they execute the body of the class in a temporary dictionary.

the metaclass sees the property but it's not initialized yet and doesn't have the getter attribute.
Comment 1 Marco Giusti 2007-08-27 15:07:31 UTC
Created attachment 94437 [details]
a test
Comment 2 Marco Giusti 2007-08-27 15:21:40 UTC
i was wong about the motivation: in gobject.__init__.py:63 there is a loop in a dictionary.

  for prop in props:

prop is the key of the dictionary. also the value is not what you expect: isn't a gobject.property but a tuple (see the line 51)

  props[name] = prop.get_pspec_args()

so both the key and the value don't have getter, setter, default_getter, default_setter attributes
Comment 3 Johan (not receiving bugmail) Dahlin 2007-08-27 16:01:56 UTC
Thanks for the bug report, I committed a fix for this to rev 699.