diff options
author | Sebastian Granjoux <seb.sfo@free.fr> | 2007-07-02 17:54:27 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2007-07-02 17:54:27 +0000 |
commit | d1e9ef6614199ea886f2bb2864410383c00fe6f4 (patch) | |
tree | e79aac9361434b11cb957b587ae78ba625a559d7 /tests/testhelpermodule.c | |
parent | e0fc94bfbdae09096f73b4378686a3ec2e8e392a (diff) | |
download | pygobject-d1e9ef6614199ea886f2bb2864410383c00fe6f4.tar.gz |
reviewed by: Johan Dahlin
2007-07-02 Sebastian Granjoux <seb.sfo@free.fr>
reviewed by: Johan Dahlin
* gobject/gobjectmodule.c: (pyg_gerror_exception_check):
* tests/test_gtype.py:
* tests/testhelpermodule.c: (_wrap_test_gerror_exception):
Fix a bug in pyg_error_exception_check, add a test, Fixes #449879
svn path=/trunk/; revision=678
Diffstat (limited to 'tests/testhelpermodule.c')
-rw-r--r-- | tests/testhelpermodule.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index d35aecc7..8d9419e2 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -468,6 +468,32 @@ _wrap_test_value_array(PyObject *self, PyObject *args) return pyg_value_as_pyobject(value, FALSE); } +static PyObject * +_wrap_test_gerror_exception(PyObject *self, PyObject *args) +{ + PyObject *py_method; + PyObject *py_args; + PyObject *py_ret; + GError *err = NULL; + + if (!PyArg_ParseTuple(args, "O", &py_method)) + return NULL; + + py_args = PyTuple_New(0); + py_ret = PyObject_CallObject(py_method, py_args); + if (pyg_gerror_exception_check(&err)) { + pyg_error_check(&err); + return NULL; + } + + Py_DECREF(py_method); + Py_DECREF(py_args); + Py_DECREF(py_ret); + + Py_INCREF(Py_None); + return Py_None; +} + static PyMethodDef testhelper_functions[] = { { "get_test_thread", (PyCFunction)_wrap_get_test_thread, METH_NOARGS }, { "get_unknown", (PyCFunction)_wrap_get_unknown, METH_NOARGS }, @@ -475,6 +501,7 @@ static PyMethodDef testhelper_functions[] = { { "test_g_object_new", (PyCFunction)_wrap_test_g_object_new, METH_NOARGS }, { "connectcallbacks", (PyCFunction)_wrap_connectcallbacks, METH_VARARGS }, { "test_value_array", (PyCFunction)_wrap_test_value_array, METH_VARARGS }, + { "test_gerror_exception", (PyCFunction)_wrap_test_gerror_exception, METH_VARARGS }, { NULL, NULL } }; |