GNOME Bugzilla – Bug 687889
Replace static GObject.get/set_property with introspection and python
Last modified: 2014-08-17 05:39:41 UTC
Now that bug 672727 has been pushed, we can start to experiment with changes like this. However, this is an area we should try to maintain good performance as heavy property access can occur when using libraries like clutter. I think if pure gi/python slows things down too much, we can still cleanup the get/set_property static methods writing/moving them into gi/_gi.so and using them from the "props" accessor implemented in python. This way we can cleanup and remove code from gi/_gobject/_gobject.so The following example shows the gi versions of get/set_property are working: from gi.repository import GObject GIObject = GObject._introspection_module class Spam(GObject.Object): eggs = GObject.Property(type=int) spam = Spam() value = GObject.Value() value.init(GObject.TYPE_INT) spam.eggs = 3 GIObject.Object.get_property(spam, 'eggs', value) value.get_int() == 3 # True value.set_int(5) GIObject.Object.set_property(spam, 'eggs', value) spam.eggs == 5 # True
I don't think we'll ever be able to do this because property access needs introspection information which will be too slow to traverse in pure Python.