diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2011-08-25 13:57:53 -0400 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2011-08-30 14:12:33 -0400 |
commit | 429569abddada5a3bad554de707ddf35b349936e (patch) | |
tree | e9374249c452577e82c7c00a991cb505c62b98aa /gi/pygi-invoke.c | |
parent | 7a234b185b131f3eb6a6e8a8c717ddf4d508b15e (diff) | |
download | pygobject-429569abddada5a3bad554de707ddf35b349936e.tar.gz |
support skip annotation for return values
* this is used for things like skiping gboolean returns that are
useful is C but useless in python
* cleans up after skipped returns that are also marked transfer
full
https://bugzilla.gnome.org/show_bug.cgi?id=650135
Diffstat (limited to 'gi/pygi-invoke.c')
-rw-r--r-- | gi/pygi-invoke.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c index 55e56ee5..4a7366c2 100644 --- a/gi/pygi-invoke.c +++ b/gi/pygi-invoke.c @@ -24,7 +24,7 @@ #include <pyglib.h> #include "pygi-invoke.h" - +#include "pygi-marshal-cleanup.h" static inline gboolean _invoke_callable (PyGIInvokeState *state, @@ -508,30 +508,42 @@ _invoke_marshal_out_args (PyGIInvokeState *state, PyGICallableCache *cache) gboolean has_return = FALSE; if (cache->return_cache) { + if (!cache->return_cache->is_skipped) { + if (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR) { + if (state->return_arg.v_pointer == NULL) { + PyErr_SetString (PyExc_TypeError, "constructor returned NULL"); + pygi_marshal_cleanup_args_return_fail (state, + cache); + return NULL; + } + } - if (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR) { - if (state->return_arg.v_pointer == NULL) { - PyErr_SetString (PyExc_TypeError, "constructor returned NULL"); + py_return = cache->return_cache->out_marshaller ( state, + cache, + cache->return_cache, + &state->return_arg); + if (py_return == NULL) { pygi_marshal_cleanup_args_return_fail (state, cache); return NULL; } - } - py_return = cache->return_cache->out_marshaller ( state, - cache, - cache->return_cache, - &state->return_arg); - if (py_return == NULL) { - pygi_marshal_cleanup_args_return_fail (state, - cache); - return NULL; - } - - if (cache->return_cache->type_tag != GI_TYPE_TAG_VOID) { - total_out_args++; - has_return = TRUE; + if (cache->return_cache->type_tag != GI_TYPE_TAG_VOID) { + total_out_args++; + has_return = TRUE; + } + } else { + if (cache->return_cache->transfer == GI_TRANSFER_EVERYTHING) { + PyGIMarshalCleanupFunc out_cleanup = + cache->return_cache->out_cleanup; + + if (out_cleanup != NULL) + out_cleanup ( state, + cache->return_cache, + &state->return_arg, + FALSE); + } } } |