summaryrefslogtreecommitdiff
path: root/gi/pygi-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'gi/pygi-cache.c')
-rw-r--r--gi/pygi-cache.c414
1 files changed, 70 insertions, 344 deletions
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 5b107e1..2f807f8 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -43,7 +43,7 @@ PyGIArgCache * _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
gssize c_arg_index,
gssize py_arg_index);
/* cleanup */
-void
+static void
_pygi_arg_cache_free (PyGIArgCache *cache)
{
if (cache == NULL)
@@ -155,14 +155,11 @@ _sequence_cache_new (GITypeInfo *type_info,
sc = g_slice_new0 (PyGISequenceCache);
( (PyGIArgCache *)sc)->destroy_notify = (GDestroyNotify)_sequence_cache_free_func;
- sc->fixed_size = -1;
- sc->len_arg_index = -1;
sc->is_zero_terminated = g_type_info_is_zero_terminated (type_info);
- if (!sc->is_zero_terminated) {
- sc->fixed_size = g_type_info_get_array_fixed_size (type_info);
- if (sc->fixed_size < 0)
- sc->len_arg_index = g_type_info_get_array_length (type_info) + child_offset;
- }
+ sc->fixed_size = g_type_info_get_array_fixed_size (type_info);
+ sc->len_arg_index = g_type_info_get_array_length (type_info);
+ if (sc->len_arg_index >= 0)
+ sc->len_arg_index += child_offset;
item_type_info = g_type_info_get_param_type (type_info, 0);
@@ -263,178 +260,34 @@ _arg_cache_alloc (void)
}
static void
-_arg_cache_from_py_void_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_void;
-}
-
-static void
-_arg_cache_to_py_void_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_void;
-}
-
-static void
-_arg_cache_from_py_boolean_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_boolean;
-}
-
-static void
-_arg_cache_to_py_boolean_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_boolean;
-}
-
-static void
-_arg_cache_from_py_int8_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_int8;
-}
-
-static void
-_arg_cache_to_py_int8_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_int8;
-}
-
-static void
-_arg_cache_from_py_uint8_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint8;
-}
-
-static void
-_arg_cache_to_py_uint8_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint8;
-}
-
-static void
-_arg_cache_from_py_int16_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_int16;
-}
-
-static void
-_arg_cache_to_py_int16_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_int16;
-}
-
-static void
-_arg_cache_from_py_uint16_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint16;
-}
-
-static void
-_arg_cache_to_py_uint16_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint16;
-}
-
-static void
-_arg_cache_from_py_int32_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_int32;
-}
-
-static void
-_arg_cache_to_py_int32_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_int32;
-}
-
-static void
-_arg_cache_from_py_uint32_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint32;
-}
-
-static void
-_arg_cache_to_py_uint32_setup (PyGIArgCache *arg_cache)
+_arg_cache_from_py_basic_type_setup (PyGIArgCache *arg_cache)
{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint32;
+ arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter;
}
static void
-_arg_cache_from_py_int64_setup (PyGIArgCache *arg_cache)
+_arg_cache_to_py_basic_type_setup (PyGIArgCache *arg_cache)
{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_int64;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter;
}
static void
-_arg_cache_to_py_int64_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_int64;
-}
-
-static void
-_arg_cache_from_py_uint64_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint64;
-}
-
-static void
-_arg_cache_to_py_uint64_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint64;
-}
-
-static void
-_arg_cache_from_py_float_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_float;
-}
-
-static void
-_arg_cache_to_py_float_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_float;
-}
-
-static void
-_arg_cache_from_py_double_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_double;
-}
-
-static void
-_arg_cache_to_py_double_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_double;
-}
-
-static void
-_arg_cache_from_py_unichar_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_unichar;
-}
-
-static void
-_arg_cache_to_py_unichar_setup (PyGIArgCache *arg_cache)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_unichar;
-}
-
-static void
-_arg_cache_from_py_gtype_setup (PyGIArgCache *arg_cache)
+_arg_cache_from_py_void_setup (PyGIArgCache *arg_cache)
{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_gtype;
+ arg_cache->from_py_marshaller = _pygi_marshal_from_py_void;
}
static void
-_arg_cache_to_py_gtype_setup (PyGIArgCache *arg_cache)
+_arg_cache_to_py_void_setup (PyGIArgCache *arg_cache)
{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_gtype;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_void;
}
static void
_arg_cache_from_py_utf8_setup (PyGIArgCache *arg_cache,
GITransfer transfer)
{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_utf8;
+ arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter;
arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_utf8;
}
@@ -442,23 +295,7 @@ static void
_arg_cache_to_py_utf8_setup (PyGIArgCache *arg_cache,
GITransfer transfer)
{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_utf8;
- arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_utf8;
-}
-
-static void
-_arg_cache_from_py_filename_setup (PyGIArgCache *arg_cache,
- GITransfer transfer)
-{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_filename;
- arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_utf8;
-}
-
-static void
-_arg_cache_to_py_filename_setup (PyGIArgCache *arg_cache,
- GITransfer transfer)
-{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_filename;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter;
arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_utf8;
}
@@ -483,6 +320,7 @@ _arg_cache_from_py_array_setup (PyGIArgCache *arg_cache,
child_cache = _arg_cache_alloc ();
} else if (child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD ||
child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE) {
+ arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_array;
return TRUE;
}
@@ -608,14 +446,14 @@ static void
_arg_cache_from_py_interface_union_setup (PyGIArgCache *arg_cache,
GITransfer transfer)
{
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct;
+ arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter;
}
static void
_arg_cache_to_py_interface_union_setup (PyGIArgCache *arg_cache,
GITransfer transfer)
{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter;
}
static void
@@ -625,7 +463,7 @@ _arg_cache_from_py_interface_struct_setup (PyGIArgCache *arg_cache,
{
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info);
- arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct;
+ arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter;
if (iface_cache->g_type == G_TYPE_VALUE)
arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_struct_gvalue;
@@ -640,7 +478,7 @@ _arg_cache_to_py_interface_struct_setup (PyGIArgCache *arg_cache,
{
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info);
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter;
if (iface_cache->is_foreign)
arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_struct_foreign;
@@ -658,7 +496,7 @@ static void
_arg_cache_to_py_interface_object_setup (PyGIArgCache *arg_cache,
GITransfer transfer)
{
- arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object;
+ arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object_cache_adapter;
arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_object;
}
@@ -681,6 +519,7 @@ _arg_cache_from_py_interface_callback_setup (PyGIArgCache *arg_cache,
callable_cache->args_cache[callback_cache->destroy_notify_index] = destroy_arg_cache;
}
arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_callback;
+ arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_callback;
}
static void
@@ -757,6 +596,7 @@ _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
_arg_cache_to_py_interface_union_setup (arg_cache, transfer);
break;
+ case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
_arg_cache_from_py_interface_struct_setup (arg_cache,
@@ -777,17 +617,6 @@ _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
_arg_cache_to_py_interface_object_setup (arg_cache, transfer);
break;
- case GI_INFO_TYPE_BOXED:
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_interface_struct_setup (arg_cache,
- iface_info,
- transfer);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_interface_struct_setup (arg_cache,
- iface_info,
- transfer);
- break;
case GI_INFO_TYPE_CALLBACK:
{
PyGICallbackCache *callback_cache;
@@ -881,161 +710,31 @@ _arg_cache_new (GITypeInfo *type_info,
break;
case GI_TYPE_TAG_BOOLEAN:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_boolean_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_boolean_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_INT8:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_int8_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_int8_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_UINT8:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_uint8_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_uint8_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_INT16:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_int16_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_int16_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_UINT16:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_uint16_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_uint16_setup (arg_cache);
- break;
case GI_TYPE_TAG_INT32:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_int32_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_int32_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_UINT32:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_uint32_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_uint32_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_INT64:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_int64_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_int64_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_UINT64:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_uint64_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_uint64_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_FLOAT:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_float_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_float_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_DOUBLE:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_double_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_double_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_UNICHAR:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_unichar_setup (arg_cache);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_unichar_setup (arg_cache);
-
- break;
case GI_TYPE_TAG_GTYPE:
arg_cache = _arg_cache_alloc ();
if (arg_cache == NULL)
break;
if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_gtype_setup (arg_cache);
+ _arg_cache_from_py_basic_type_setup (arg_cache);
if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_gtype_setup (arg_cache);
+ _arg_cache_to_py_basic_type_setup (arg_cache);
break;
case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
arg_cache = _arg_cache_alloc ();
if (arg_cache == NULL)
break;
@@ -1047,18 +746,6 @@ _arg_cache_new (GITypeInfo *type_info,
_arg_cache_to_py_utf8_setup (arg_cache, transfer);
break;
- case GI_TYPE_TAG_FILENAME:
- arg_cache = _arg_cache_alloc ();
- if (arg_cache == NULL)
- break;
-
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_filename_setup (arg_cache, transfer);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_filename_setup (arg_cache, transfer);
-
- break;
case GI_TYPE_TAG_ARRAY:
{
PyGISequenceCache *seq_cache =
@@ -1233,6 +920,7 @@ _arg_name_list_generate (PyGICallableCache *callable_cache)
arg_cache = callable_cache->args_cache[i];
if (arg_cache->meta_type != PYGI_META_ARG_TYPE_CHILD &&
+ arg_cache->meta_type != PYGI_META_ARG_TYPE_CLOSURE &&
(arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON ||
arg_cache->direction == PYGI_DIRECTION_BIDIRECTIONAL)) {
@@ -1279,6 +967,8 @@ _args_cache_generate (GICallableInfo *callable_info,
return_direction,
-1,
-1);
+ if (return_cache == NULL)
+ return FALSE;
return_cache->is_skipped = g_callable_info_skip_return (callable_info);
callable_cache->return_cache = return_cache;
@@ -1331,8 +1021,24 @@ _args_cache_generate (GICallableInfo *callable_info,
gboolean is_caller_allocates = FALSE;
gssize py_arg_index = -1;
- arg_info =
- g_callable_info_get_arg (callable_info, i);
+ arg_info = g_callable_info_get_arg (callable_info, i);
+
+ if (g_arg_info_get_closure (arg_info) == i) {
+
+ arg_cache = _arg_cache_alloc ();
+ callable_cache->args_cache[arg_index] = arg_cache;
+
+ arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info);
+ arg_cache->direction = PYGI_DIRECTION_FROM_PYTHON;
+ arg_cache->meta_type = PYGI_META_ARG_TYPE_CLOSURE;
+ arg_cache->c_arg_index = i;
+
+ callable_cache->n_from_py_args++;
+
+ g_base_info_unref ( (GIBaseInfo *)arg_info);
+
+ continue;
+ }
/* For vfuncs and callbacks our marshalling directions
are reversed */
@@ -1353,7 +1059,7 @@ _args_cache_generate (GICallableInfo *callable_info,
type_info = g_arg_info_get_type (arg_info);
type_tag = g_type_info_get_tag (type_info);
- if (type_tag == GI_TYPE_TAG_INTERFACE)
+ if (type_tag == GI_TYPE_TAG_INTERFACE || type_tag == GI_TYPE_TAG_ARRAY)
is_caller_allocates = g_arg_info_is_caller_allocates (arg_info);
/* must be an child arg filled in by its owner
@@ -1377,6 +1083,9 @@ _args_cache_generate (GICallableInfo *callable_info,
callable_cache->n_to_py_child_args++;
}
+ arg_cache->type_tag = g_type_info_get_tag (type_info);
+
+ g_base_info_unref (type_info);
g_base_info_unref ( (GIBaseInfo *)arg_info);
continue;
}
@@ -1430,7 +1139,7 @@ arg_err:
}
PyGICallableCache *
-_pygi_callable_cache_new (GICallableInfo *callable_info)
+_pygi_callable_cache_new (GICallableInfo *callable_info, gboolean is_ccallback)
{
PyGICallableCache *cache;
GIInfoType type = g_base_info_get_type ( (GIBaseInfo *)callable_info);
@@ -1442,6 +1151,20 @@ _pygi_callable_cache_new (GICallableInfo *callable_info)
cache->name = g_base_info_get_name ((GIBaseInfo *)callable_info);
+ if (g_base_info_is_deprecated (callable_info)) {
+ const gchar *deprecated = g_base_info_get_attribute (callable_info, "deprecated");
+ gchar *warning;
+ if (deprecated != NULL)
+ warning = g_strdup_printf ("%s.%s is deprecated: %s",
+ g_base_info_get_namespace (callable_info), cache->name,
+ deprecated);
+ else
+ warning = g_strdup_printf ("%s.%s is deprecated",
+ g_base_info_get_namespace (callable_info), cache->name);
+ PyErr_WarnEx(PyExc_DeprecationWarning, warning, 0);
+ g_free (warning);
+ }
+
if (type == GI_INFO_TYPE_FUNCTION) {
GIFunctionInfoFlags flags;
@@ -1454,7 +1177,10 @@ _pygi_callable_cache_new (GICallableInfo *callable_info)
} else if (type == GI_INFO_TYPE_VFUNC) {
cache->function_type = PYGI_FUNCTION_TYPE_VFUNC;
} else if (type == GI_INFO_TYPE_CALLBACK) {
- cache->function_type = PYGI_FUNCTION_TYPE_CALLBACK;
+ if (is_ccallback)
+ cache->function_type = PYGI_FUNCTION_TYPE_CCALLBACK;
+ else
+ cache->function_type = PYGI_FUNCTION_TYPE_CALLBACK;
} else {
cache->function_type = PYGI_FUNCTION_TYPE_METHOD;
}