summaryrefslogtreecommitdiff
path: root/gi/pygi-invoke.c
diff options
context:
space:
mode:
authorLaszlo Pandy <lpandy@src.gnome.org>2011-01-19 17:45:11 +0100
committerLaszlo Pandy <lpandy@src.gnome.org>2011-01-19 18:25:49 +0100
commit25b69ae257a12b6dc97ed3f2f7ea54b166ddbba1 (patch)
tree7311fa6ec3b07198b913364f52ce145a618e3b61 /gi/pygi-invoke.c
parente6fcafc6179e963cbae7774e7ee50415bde2c523 (diff)
downloadpygobject-25b69ae257a12b6dc97ed3f2f7ea54b166ddbba1.tar.gz
[gi] Convert GErrors to GObject.GError exceptions, and throw them upon returning from calling the C function.
This changes gi to make use of pyglib_error_check() which already exists in pyglib. The included tests make use of the other patch attached to this bug, to check that the right exception is thrown from the new function in GIMarshallingTests. two Gtk C functions. https://bugzilla.gnome.org/show_bug.cgi?id=639834
Diffstat (limited to 'gi/pygi-invoke.c')
-rw-r--r--gi/pygi-invoke.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index a92c68e7..e998df74 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -21,6 +21,7 @@
* USA
*/
+#include <pyglib.h>
#include "pygi-invoke.h"
struct invocation_state
@@ -604,10 +605,7 @@ _invoke_function (struct invocation_state *state,
pyg_end_allow_threads;
if (!retval) {
- g_assert (error != NULL);
- /* TODO: raise the right error, out of the error domain. */
- PyErr_SetString (PyExc_RuntimeError, error->message);
- g_error_free (error);
+ pyglib_error_check(&error);
/* TODO: release input arguments. */
@@ -619,11 +617,7 @@ _invoke_function (struct invocation_state *state,
error = state->args[state->error_arg_pos]->v_pointer;
- if (*error != NULL) {
- /* TODO: raise the right error, out of the error domain, if applicable. */
- PyErr_SetString (PyExc_Exception, (*error)->message);
- g_error_free (*error);
-
+ if (pyglib_error_check(error)) {
/* TODO: release input arguments. */
return FALSE;