[pygobject] Check object type before Python objects are created
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Check object type before Python objects are created
- Date: Mon, 28 Mar 2022 05:01:10 +0000 (UTC)
commit 066223dab7b9c10543d88cb04c64f76fe4d7815d
Author: Arjan Molenaar <gaphor gmail com>
Date: Tue Aug 3 17:43:45 2021 +0200
Check object type before Python objects are created
gi/pygi-object.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gi/pygi-object.c b/gi/pygi-object.c
index 00b36c1b..1ceab24d 100644
--- a/gi/pygi-object.c
+++ b/gi/pygi-object.c
@@ -235,10 +235,14 @@ pygi_arg_gobject_to_py (GIArgument *arg, GITransfer transfer) {
if (transfer == GI_TRANSFER_EVERYTHING)
g_param_spec_unref (arg->v_pointer);
- } else {
+ } else if (G_IS_OBJECT(arg->v_pointer)) {
pyobj = pygobject_new_full (arg->v_pointer,
/*steal=*/ transfer == GI_TRANSFER_EVERYTHING,
/*type=*/ NULL);
+ } else {
+ g_warning("No means to translate argument or return value for '%s'",
g_type_name_from_instance(arg->v_pointer));
+ pyobj = Py_None;
+ Py_INCREF (pyobj);
}
return pyobj;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]