[pygobject] Derive PyCallbackInfo from PyCallableInfo



commit f129e78d579b7897cb86111c524d87b5b12019ad
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sat May 3 22:56:03 2014 -0700

    Derive PyCallbackInfo from PyCallableInfo
    
    Update the static GI bindings for PyGICallbackInfo to derive
    from PyGICallableInfo. This makes all the gi.CallableInfo methods
    available to gi.CallbackInfo for use from Python.

 gi/pygi-info.c           |    4 ++--
 tests/test_repository.py |    7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 065d470..5ce4337 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -766,7 +766,7 @@ static PyMethodDef _PyGICallableInfo_methods[] = {
 };
 
 /* CallbackInfo */
-PYGLIB_DEFINE_TYPE ("gi.CallbackInfo", PyGICallbackInfo_Type, PyGIBaseInfo);
+PYGLIB_DEFINE_TYPE ("gi.CallbackInfo", PyGICallbackInfo_Type, PyGICallableInfo);
 
 static PyMethodDef _PyGICallbackInfo_methods[] = {
     { NULL, NULL, 0 }
@@ -2185,7 +2185,7 @@ _pygi_info_register_types (PyObject *m)
     _PyGI_REGISTER_TYPE (m, PyGIUnresolvedInfo_Type, UnresolvedInfo,
                          PyGIBaseInfo_Type);
     _PyGI_REGISTER_TYPE (m, PyGICallbackInfo_Type, CallbackInfo,
-                         PyGIBaseInfo_Type);
+                         PyGICallableInfo_Type);
     _PyGI_REGISTER_TYPE (m, PyGIRegisteredTypeInfo_Type, RegisteredTypeInfo,
                          PyGIBaseInfo_Type);
     _PyGI_REGISTER_TYPE (m, PyGIStructInfo_Type, StructInfo,
diff --git a/tests/test_repository.py b/tests/test_repository.py
index c02581c..88132e6 100644
--- a/tests/test_repository.py
+++ b/tests/test_repository.py
@@ -100,6 +100,13 @@ class Test(unittest.TestCase):
         self.assertFalse(info.get_fundamental())
         self.assertEqual(info.get_parent(), repo.find_by_name('GObject', 'Object'))
 
+    def test_callable_inheritance(self):
+        self.assertTrue(issubclass(GIRepository.CallableInfo, GIRepository.BaseInfo))
+        self.assertTrue(issubclass(GIRepository.CallbackInfo, GIRepository.CallableInfo))
+        self.assertTrue(issubclass(GIRepository.FunctionInfo, GIRepository.CallableInfo))
+        self.assertTrue(issubclass(GIRepository.VFuncInfo, GIRepository.CallableInfo))
+        self.assertTrue(issubclass(GIRepository.SignalInfo, GIRepository.CallableInfo))
+
     def test_registered_type_info(self):
         info = repo.find_by_name('GIMarshallingTests', 'Object')
         # Call these from the class because GIObjectInfo overrides them


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