diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2011-01-19 09:13:44 -0500 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2011-01-19 09:13:44 -0500 |
commit | 5f16df31b5a5a9f45f702eee48c3a18899ea3f71 (patch) | |
tree | 0556b700596a30dd61aacc983389a7e4181d90ef /gi/pygi-foreign.c | |
parent | 6ab3d8d286573289cf8e41eee31eb806621f6f43 (diff) | |
download | pygobject-5f16df31b5a5a9f45f702eee48c3a18899ea3f71.tar.gz |
[gi] fix marshalling structs
Diffstat (limited to 'gi/pygi-foreign.c')
-rw-r--r-- | gi/pygi-foreign.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c index 75d5bb91..fa43005a 100644 --- a/gi/pygi-foreign.c +++ b/gi/pygi-foreign.c @@ -106,23 +106,29 @@ pygi_struct_foreign_lookup (GIBaseInfo *base_info) return result; } -PyObject * +gboolean pygi_struct_foreign_convert_to_g_argument (PyObject *value, GITypeInfo *type_info, GITransfer transfer, GIArgument *arg) { + PyObject *result; GIBaseInfo *base_info = g_type_info_get_interface (type_info); PyGIForeignStruct *foreign_struct = pygi_struct_foreign_lookup (base_info); g_base_info_unref (base_info); - if (foreign_struct == NULL) - return NULL; + if (foreign_struct == NULL) { + PyErr_Format(PyExc_KeyError, "could not find foreign type %s", + g_base_info_get_name (base_info)); + return FALSE; + } - if (!foreign_struct->to_func (value, type_info, transfer, arg)) - return NULL; + result = foreign_struct->to_func (value, type_info, transfer, arg); + if (result == NULL) + return FALSE; - Py_RETURN_NONE; + Py_DECREF(result); + return TRUE; } PyObject * |