summaryrefslogtreecommitdiff
path: root/gi/pygi-argument.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:36:13 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:36:14 +0900
commitd3b61d1e80a91482c2fc844810627064b1087280 (patch)
tree31e43590946ac70b8a14429f488f1e4f01956293 /gi/pygi-argument.c
parent385fb5df2f7c3ec197b954e8a8ddac5297fe4043 (diff)
downloadpygobject2-d3b61d1e80a91482c2fc844810627064b1087280.tar.gz
pygobject2-d3b61d1e80a91482c2fc844810627064b1087280.tar.bz2
pygobject2-d3b61d1e80a91482c2fc844810627064b1087280.zip
Imported Upstream version 2.28.1
Change-Id: Ib2dc5ea9bbd21a07cf091b6a5352485ef15f637a Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/pygi-argument.c')
-rw-r--r--gi/pygi-argument.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 1b31387..6519e5c 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -224,7 +224,8 @@ _pygi_g_type_interface_check_object (GIBaseInfo *info,
/* Handle special cases. */
type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
if (g_type_is_a (type, G_TYPE_CLOSURE)) {
- if (!PyCallable_Check (object)) {
+ if (!(PyCallable_Check (object) ||
+ pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE)) {
PyErr_Format (PyExc_TypeError, "Must be callable, not %s",
object->ob_type->tp_name);
retval = 0;
@@ -1072,10 +1073,14 @@ array_success:
} else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
GClosure *closure;
- closure = pyg_closure_new (object, NULL, NULL);
- if (closure == NULL) {
- PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed");
- break;
+ if (pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE) {
+ closure = (GClosure *)pyg_boxed_get (object, void);
+ } else {
+ closure = pyg_closure_new (object, NULL, NULL);
+ if (closure == NULL) {
+ PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed");
+ break;
+ }
}
arg.v_pointer = closure;