[pybank] Add support for functions returning NULL
- From: Johan Dahlin <johan src gnome org>
- To: svn-commits-list gnome org
- Subject: [pybank] Add support for functions returning NULL
- Date: Tue, 5 May 2009 10:00:09 -0400 (EDT)
commit aed8aed09e3f87e0e53feb283a0217e4b2b171fe
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Tue May 5 15:22:43 2009 +0200
Add support for functions returning NULL
---
bank/bank-argument.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/bank/bank-argument.c b/bank/bank-argument.c
index 06523a7..0920484 100644
--- a/bank/bank-argument.c
+++ b/bank/bank-argument.c
@@ -113,12 +113,18 @@ pyg_argument_to_pyobject(GArgument *arg, GITypeInfo *type_info)
g_return_val_if_fail(type_info != NULL, NULL);
type_tag = g_type_info_get_tag(type_info);
if ( type_tag == GI_TYPE_TAG_INTERFACE ) {
- GValue value;
- GObject* obj = arg->v_pointer;
- GType gtype = G_OBJECT_TYPE(obj);
- value.g_type = gtype;
- value.data[0].v_pointer = obj;
- return pyg_value_as_pyobject(&value, FALSE);
+ if ( arg->v_pointer == NULL ) {
+ obj = Py_None;
+ Py_INCREF(obj);
+ return obj;
+ } else {
+ GValue value;
+ GObject* obj = arg->v_pointer;
+ GType gtype = G_OBJECT_TYPE(obj);
+ value.g_type = gtype;
+ value.data[0].v_pointer = obj;
+ return pyg_value_as_pyobject(&value, FALSE);
+ }
}
switch (type_tag) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]