[pygobject] Stop checking that all vfuncs are implemented



commit 769da968c9187414d0420412d8fb8c833d12042a
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Wed Dec 8 17:38:11 2010 +0100

    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

 gi/gimodule.c    |    4 +++-
 gi/types.py      |   12 ++----------
 tests/test_gi.py |   10 ----------
 3 files changed, 5 insertions(+), 21 deletions(-)
---
diff --git a/gi/gimodule.c b/gi/gimodule.c
index e61f099..acbd6df 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -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 }
diff --git a/gi/types.py b/gi/types.py
index 8bf6fd7..cc43d02 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -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__)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 7621bbe..d1566c6 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -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):



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