diff options
author | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2005-07-30 14:26:49 +0000 |
---|---|---|
committer | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2005-07-30 14:26:49 +0000 |
commit | da3f23c74c828acbbeaaa6891f2a245d9379dde3 (patch) | |
tree | a73cf09e6691e7256361734df92908647786b8b8 | |
parent | 3887e4cc9989a1e215e62d17938c0cd361ff9b61 (diff) | |
download | pygobject-da3f23c74c828acbbeaaa6891f2a245d9379dde3.tar.gz pygobject-da3f23c74c828acbbeaaa6891f2a245d9379dde3.tar.xz pygobject-da3f23c74c828acbbeaaa6891f2a245d9379dde3.zip |
Fixes Bug 311309: subclassing gtk.Bin reports...
-rw-r--r-- | gobject/gobjectmodule.c | 5 | ||||
-rw-r--r-- | tests/test_subtype.py | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 603ca23..002d117 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1158,10 +1158,7 @@ pyg_type_register(PyTypeObject *class, char *type_name) /* propagate new constructor API compatility flag from parent to child type */ has_new_constructor_api = g_type_get_qdata(parent_type, pygobject_has_updated_constructor_key); - if (has_new_constructor_api == NULL) - g_warning("Constructor wrapper for %s needs to be updated to the new API", - g_type_name(parent_type)); - else + if (has_new_constructor_api != NULL) g_type_set_qdata(instance_type, pygobject_has_updated_constructor_key, has_new_constructor_api); diff --git a/tests/test_subtype.py b/tests/test_subtype.py index 0de6074..a48452c 100644 --- a/tests/test_subtype.py +++ b/tests/test_subtype.py @@ -40,3 +40,15 @@ class TestSubType(unittest.TestCase): refcount = testhelper.test_g_object_new() self.assertEqual(refcount, 2) + def testMassiveGtkSubclassing(self): + for name, cls in [(name, getattr(gtk, name)) for name in dir(gtk)]: + ## Skip some deprecated types + if name in ['CTree', '_gobject']: + continue + try: + if not issubclass(cls, gobject.GObject): + continue + except TypeError: # raised by issubclass if cls is not a class + continue + subname = name + "PyGtkTestSubclass" + sub = type(subname, (cls,), {'__gtype_name__': subname }) |