[pygobject/pygobject-3-8] Fix vfunc info search for classes with multiple inheritance



commit 33030b4495c290c3f59a47fd7dc54bba0e617faa
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sun May 12 18:58:06 2013 -0700

    Fix vfunc info search for classes with multiple inheritance
    
    Ensure the search for vfunc GI info continues recursively even if the
    current class being looked at does not contain GI info of type
    InterfaceInfo. This more exhaustive search is needed for setups with
    multiple sub-classes and multiple inheritance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700092

 gi/types.py      |   12 +++++++-----
 tests/test_gi.py |    1 -
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gi/types.py b/gi/types.py
index c44833d..47a81d8 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -245,14 +245,16 @@ def find_vfunc_info_in_interface(bases, vfunc_name):
         # Skip bases without __info__ (static _gobject._gobject.GObject)
         if base is GInterface or\
                 not issubclass(base, GInterface) or\
-                not hasattr(base, '__info__') or\
-                not isinstance(base.__info__, InterfaceInfo):
+                not hasattr(base, '__info__'):
             continue
 
-        for vfunc in base.__info__.get_vfuncs():
-            if vfunc.get_name() == vfunc_name:
-                return vfunc
+        # Only look at this classes vfuncs if it is an interface.
+        if isinstance(base.__info__, InterfaceInfo):
+            for vfunc in base.__info__.get_vfuncs():
+                if vfunc.get_name() == vfunc_name:
+                    return vfunc
 
+        # Recurse into the parent classes
         vfunc = find_vfunc_info_in_interface(base.__bases__, vfunc_name)
         if vfunc is not None:
             return vfunc
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 33a77ab..13e87f4 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2295,7 +2295,6 @@ class TestInterfaces(unittest.TestCase):
         GIMarshallingTests.test_interface_test_int8_in(instance, 42)
         self.assertEqual(instance.val, 42)
 
-    @unittest.expectedFailure  # https://bugzilla.gnome.org/show_bug.cgi?id=700092
     def test_subclass_override(self):
         class TestInterfaceImplD(TestInterfaces.TestInterfaceImpl):
             val2 = None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]