[pygobject] Don't use GI type for determining pointer extraction from GValues



commit 74722386192ad27aac8855d4603d8120af82c98e
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Aug 18 02:05:58 2014 -0700

    Don't use GI type for determining pointer extraction from GValues
    
    Replace usage of g_type_is_a() with G_VALUE_HOLDS() when extracting
    pointers from GValues being marshalled from properties and signals.
    This fixes fallout from commit abdfb0f.

 gi/pygi-value.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gi/pygi-value.c b/gi/pygi-value.c
index 0e6647d..9d5d0ca 100644
--- a/gi/pygi-value.c
+++ b/gi/pygi-value.c
@@ -102,10 +102,8 @@ _pygi_argument_from_g_value(const GValue *value,
         {
             GIBaseInfo *info;
             GIInfoType info_type;
-            GType type;
 
             info = g_type_info_get_interface (type_info);
-            type = g_registered_type_info_get_g_type (info);
             info_type = g_base_info_get_type (info);
 
             g_base_info_unref (info);
@@ -127,16 +125,16 @@ _pygi_argument_from_g_value(const GValue *value,
                 case GI_INFO_TYPE_BOXED:
                 case GI_INFO_TYPE_STRUCT:
                 case GI_INFO_TYPE_UNION:
-                    if (g_type_is_a (type, G_TYPE_BOXED)) {
+                    if (G_VALUE_HOLDS (value, G_TYPE_BOXED)) {
                         arg.v_pointer = g_value_get_boxed (value);
-                    } else if (g_type_is_a (type, G_TYPE_VARIANT)) {
+                    } else if (G_VALUE_HOLDS (value, G_TYPE_VARIANT)) {
                         arg.v_pointer = g_value_get_variant (value);
-                    } else if (g_type_is_a (type, G_TYPE_POINTER)) {
+                    } else if (G_VALUE_HOLDS (value, G_TYPE_POINTER)) {
                         arg.v_pointer = g_value_get_pointer (value);
                     } else {
                         PyErr_Format (PyExc_NotImplementedError,
                                       "Converting GValue's of type '%s' is not implemented.",
-                                      g_type_name (type));
+                                      g_type_name (G_VALUE_TYPE (value)));
                     }
                     break;
                 default:


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