Commit 9baf3240 authored by John (J5) Palmieri's avatar John (J5) Palmieri
Browse files

[gi] handle allow_none for all args

parent d54d12c6
......@@ -1000,7 +1000,8 @@ _args_cache_generate(GIFunctionInfo *function_info,
if (arg_cache == NULL)
goto arg_err;
arg_cache->allow_none = g_arg_info_may_be_null (arg_info);
function_cache->in_args =
g_slist_append(function_cache->in_args, arg_cache);
break;
......
......@@ -48,6 +48,7 @@ struct _PyGIArgCache
gboolean is_aux;
gboolean is_pointer;
gboolean is_caller_allocates;
gboolean allow_none;
GIDirection direction;
GITransfer transfer;
......
......@@ -986,6 +986,13 @@ _invoke_marshal_in_args(PyGIInvokeState *state, PyGIFunctionCache *cache)
c_arg = state->args[i];
if (arg_cache->in_marshaller != NULL) {
if (!arg_cache->allow_none && py_arg == Py_None) {
PyErr_Format(PyExc_TypeError,
"Argument %i does not allow None as a value",
i);
return FALSE;
}
gboolean success = arg_cache->in_marshaller(state,
cache,
arg_cache,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment