Commit 769da968 authored by Tomeu Vizoso's avatar Tomeu Vizoso
Browse files

Stop checking that all vfuncs are implemented

Because some methods are optionally implementable but g-i won't
tell us.

https://bugzilla.gnome.org/show_bug.cgi?id=619606
parent 167a01c4
......@@ -253,6 +253,8 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
#if 0
/* Not used, left around for future reference */
static PyObject *
_wrap_pyg_has_vfunc_implementation (PyObject *self, PyObject *args)
{
......@@ -291,6 +293,7 @@ _wrap_pyg_has_vfunc_implementation (PyObject *self, PyObject *args)
Py_INCREF(py_ret);
return py_ret;
}
#endif
static PyObject *
_wrap_pyg_variant_new_tuple (PyObject *self, PyObject *args)
......@@ -355,7 +358,6 @@ static PyMethodDef _gi_functions[] = {
{ "set_object_has_new_constructor", (PyCFunction) _wrap_pyg_set_object_has_new_constructor, METH_VARARGS | METH_KEYWORDS },
{ "register_interface_info", (PyCFunction) _wrap_pyg_register_interface_info, METH_VARARGS },
{ "hook_up_vfunc_implementation", (PyCFunction) _wrap_pyg_hook_up_vfunc_implementation, METH_VARARGS },
{ "has_vfunc_implementation", (PyCFunction) _wrap_pyg_has_vfunc_implementation, METH_VARARGS },
{ "variant_new_tuple", (PyCFunction) _wrap_pyg_variant_new_tuple, METH_VARARGS },
{ "variant_type_from_string", (PyCFunction) _wrap_pyg_variant_type_from_string, METH_VARARGS },
{ NULL, NULL, 0 }
......
......@@ -31,8 +31,7 @@ from ._gi import \
StructInfo, \
set_object_has_new_constructor, \
register_interface_info, \
hook_up_vfunc_implementation, \
has_vfunc_implementation
hook_up_vfunc_implementation
def Function(info):
......@@ -101,14 +100,7 @@ class MetaClassHelper(object):
for vfunc_info in base.__info__.get_vfuncs():
vfunc_name = 'do_' + vfunc_info.get_name()
vfunc = getattr(impl, vfunc_name, None)
if vfunc is None and isinstance(base.__info__, InterfaceInfo) and \
impl.__module__.startswith('gi.overrides') is False and \
not has_vfunc_implementation(vfunc_info, impl.__gtype__):
raise TypeError('Class implementing %s.%s should implement '
'the method %s()' % (base.__info__.get_namespace(),
base.__info__.get_name(),
vfunc_name))
elif vfunc is not None:
if vfunc is not None:
# check to see if there are vfuncs with the same name in the bases
# we have no way of specifying which one we are supposed to override
ambiguous_base = find_vfunc_conflict_in_bases(vfunc_info, cls.__bases__)
......
......@@ -1443,16 +1443,6 @@ class TestInterfaces(unittest.TestCase):
self.assertEquals(GIMarshallingTests.Interface.__gtype__.name, 'GIMarshallingTestsInterface')
self.assertRaises(NotImplementedError, GIMarshallingTests.Interface)
def test_incomplete(self):
def create_incomplete():
class TestInterfaceImpl(GObject.GObject, GIMarshallingTests.Interface):
__type_name__ = 'TestInterfaceImpl'
def __init__(self):
GObject.GObject.__init__(self)
self.assertRaises(TypeError, create_incomplete)
def test_implementation(self):
class TestInterfaceImpl(GObject.GObject, GIMarshallingTests.Interface):
......
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