summaryrefslogtreecommitdiffstats
path: root/gobject
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gjc@src.gnome.org>2009-01-09 19:13:38 +0000
committerGustavo J. A. M. Carneiro <gjc@src.gnome.org>2009-01-09 19:13:38 +0000
commitb5cf45145e8f0f62511aa072c0768612426455f1 (patch)
treeddd628178d622443fd3c8ca96d2559de818471e9 /gobject
parente9c6012f1a344a136dd1b94d8b2c96c7438f9218 (diff)
downloadpygobject-b5cf45145e8f0f62511aa072c0768612426455f1.tar.gz
pygobject-b5cf45145e8f0f62511aa072c0768612426455f1.tar.xz
pygobject-b5cf45145e8f0f62511aa072c0768612426455f1.zip
Add a comment explaining why the two for loops for registering interfaces.
* gobject/gobjectmodule.c (pyg_type_register): Add a comment explaining why the two for loops for registering interfaces. svn path=/trunk/; revision=995
Diffstat (limited to 'gobject')
-rw-r--r--gobject/gobjectmodule.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index aa7ee49..4180fbe 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1139,6 +1139,35 @@ pyg_type_register(PyTypeObject *class, const char *type_name)
pyg_object_descr_doc_get());
}
+ /*
+ * Note: Interfaces to be implemented are searched twice. First
+ * we register interfaces that are already implemented by a parent
+ * type. The second time, the remaining interfaces are
+ * registered, i.e. the ones that are not implemented by a parent
+ * type. In between these two loops, properties and signals are
+ * registered. It has to be done this way, in two steps,
+ * otherwise glib will complain. If registering all interfaces
+ * always before properties, you get an error like:
+ *
+ * ../gobject:121: Warning: Object class
+ * test_interface+MyObject doesn't implement property
+ * 'some-property' from interface 'TestInterface'
+ *
+ * If, on the other hand, you register interfaces after
+ * registering the properties, you get something like:
+ *
+ * ../gobject:121: Warning: cannot add interface type
+ * `TestInterface' to type `test_interface+MyUnknown', since
+ * type `test_interface+MyUnknown' already conforms to
+ * interface
+ *
+ * This looks like a GLib quirk, but no bug has been filed
+ * upstream. However we have a unit test for this particular
+ * problem, which can be found in test_interfaces.py, class
+ * TestInterfaceImpl.
+ */
+
+
/* Register interfaces that are already defined by the parent
* type and are going to be reimplemented */
if (class->tp_bases) {