[pygobject/invoke-rewrite] [gi] error out if the constructor returns NULL



commit e7699d9af41f8c374326b8a4ec0939ef1426e386
Author: John (J5) Palmieri <johnp redhat com>
Date:   Fri Jan 21 04:28:15 2011 -0500

    [gi] error out if the constructor returns NULL

 gi/pygi-invoke.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index 3414afd..d5ec915 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -1038,6 +1038,13 @@ _invoke_marshal_out_args(PyGIInvokeState *state, PyGIFunctionCache *cache)
     gboolean has_return = FALSE;
 
     if (cache->return_cache) {
+        if (cache->is_constructor) {
+            if (state->return_arg.v_pointer == NULL) {
+                PyErr_SetString (PyExc_TypeError, "constructor returned NULL");
+                return NULL;
+            }
+        }
+
         py_return = cache->return_cache->out_marshaller(state,
                                                         cache,
                                                         cache->return_cache,



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