Commit 5e20c018 authored by Tomeu Vizoso's avatar Tomeu Vizoso
Browse files

Only hookup vfunc implementations for locally-defined methods

https://bugzilla.gnome.org/show_bug.cgi?id=617160
parent 3e61e7d4
......@@ -104,10 +104,18 @@ class MetaClassHelper(object):
'the method do_%s()' % (base.__info__.get_namespace(),
base.__info__.get_name(),
vfunc_info.get_name()))
elif vfunc is not None:
elif vfunc is not None and not \
is_function_in_classes(vfunc.im_func, cls.__bases__):
hook_up_vfunc_implementation(vfunc_info, cls.__gtype__,
vfunc)
def is_function_in_classes(function, classes):
for klass in classes:
if function in klass.__dict__.values():
return True
elif is_function_in_classes(function, klass.__bases__):
return True
return False
class GObjectMeta(gobject.GObjectMeta, MetaClassHelper):
......
......@@ -1476,6 +1476,16 @@ class TestInterfaces(unittest.TestCase):
GIMarshallingTests.test_interface_test_int8_in(instance, 42)
self.assertEquals(instance.val, 42)
class TestInterfaceImplA(TestInterfaceImpl):
__gtype_name__ = 'TestInterfaceImplA'
class TestInterfaceImplB(TestInterfaceImplA):
__gtype_name__ = 'TestInterfaceImplB'
instance = TestInterfaceImplA()
GIMarshallingTests.test_interface_test_int8_in(instance, 42)
self.assertEquals(instance.val, 42)
class TestOverrides(unittest.TestCase):
def test_constant(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment