[pygobject/pygobject-2-28] Skip GError out parameters in Python closure.



commit 2737e1c2c506cd324a0aa2abfdfeb3ad4f08e678
Author: Laszlo Pandy <lpandy src gnome org>
Date:   Fri Feb 18 22:48:59 2011 +0100

    Skip GError out parameters in Python closure.
    
    Python code should have never have to explicitely return a GError.
    Once we are able to marshal exceptions the Python code should
    throw an exception instead. Until then, set GError to NULL, and
    don't complain if a Python function doesn't return an arg for it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642715

 gi/pygi-closure.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 33a8d81..56ddc8b 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -295,6 +295,14 @@ _pygi_closure_set_out_arguments (GICallableInfo *callable_info,
 
         if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
             GITransfer transfer = g_arg_info_get_ownership_transfer (arg_info);
+
+            if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ERROR) {
+                /* TODO: check if an exception has been set and convert it to a GError */
+                out_args[i_out_args].v_pointer = NULL;
+                i_out_args++;
+                continue;
+            }
+
             if (PyTuple_Check (py_retval)) {
                 PyObject *item = PyTuple_GET_ITEM (py_retval, i_py_retval);
                 _pygi_closure_assign_pyobj_to_out_argument (



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]