diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:38:27 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:38:29 +0900 |
commit | 06b7709867b9e43162fa6c6fd6a10063762b875a (patch) | |
tree | fce18c2217b882849391ca2b38abdefe3843ec81 /gi/pygi-argument.c | |
parent | d54598b29c5a784bd64ae3fc9b96c97e5e150d5e (diff) | |
download | pygobject2-06b7709867b9e43162fa6c6fd6a10063762b875a.tar.gz pygobject2-06b7709867b9e43162fa6c6fd6a10063762b875a.tar.bz2 pygobject2-06b7709867b9e43162fa6c6fd6a10063762b875a.zip |
Imported Upstream version 3.1.0
Change-Id: I7ba3a430bce4104bf4e8ff695f0582bdc450560a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/pygi-argument.c')
-rw-r--r-- | gi/pygi-argument.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index 3b36c2f..9d99c35 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -1785,19 +1785,29 @@ _pygi_argument_to_object (GIArgument *arg, break; } case GI_TYPE_TAG_ERROR: - if (pyglib_error_check ( (GError **) &arg->v_pointer)) { - PyObject *err_type; - PyObject *err_value; - PyObject *err_trace; - PyErr_Fetch (&err_type, &err_value, &err_trace); - Py_XDECREF (err_type); - Py_XDECREF (err_trace); - object = err_value; - } else { - object = Py_None; - Py_INCREF (object); - break; - } + { + GError *error = (GError *) arg->v_pointer; + if (error != NULL && transfer == GI_TRANSFER_NOTHING) { + /* If we have not been transferred the ownership we must copy + * the error, because pyglib_error_check() is going to free it. + */ + error = g_error_copy (error); + } + + if (pyglib_error_check (&error)) { + PyObject *err_type; + PyObject *err_value; + PyObject *err_trace; + PyErr_Fetch (&err_type, &err_value, &err_trace); + Py_XDECREF (err_type); + Py_XDECREF (err_trace); + object = err_value; + } else { + object = Py_None; + Py_INCREF (object); + break; + } + } } return object; |