diff options
author | Johan Dahlin <johan@gnome.org> | 2007-04-30 02:43:37 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2007-04-30 02:43:37 +0000 |
commit | 958b9aa52ce7a5c774f26f92adea06579242b28a (patch) | |
tree | 2b76e24a5e12a25cc03bd7b1298b933b08db0a2f /tests/testhelpermodule.c | |
parent | 7da08ab393e14d020d77d3e67db4edbc2742e95f (diff) | |
download | pygobject-958b9aa52ce7a5c774f26f92adea06579242b28a.tar.gz pygobject-958b9aa52ce7a5c774f26f92adea06579242b28a.tar.xz pygobject-958b9aa52ce7a5c774f26f92adea06579242b28a.zip |
Treat None in a GValueArray as pointer/NULL, patch by Ed Catmur, fixes
2007-04-29 Johan Dahlin <johan@gnome.org>
* gobject/pygtype.c: (pyg_value_array_from_pyobject):
* tests/test_gtype.py:
* tests/testhelpermodule.c: (_wrap_test_value_array):
Treat None in a GValueArray as pointer/NULL, patch by
Ed Catmur, fixes #352209.
svn path=/trunk/; revision=656
Diffstat (limited to 'tests/testhelpermodule.c')
-rw-r--r-- | tests/testhelpermodule.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index c811876..95542a3 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -450,12 +450,31 @@ _wrap_connectcallbacks(PyObject * self, PyObject *args) return Py_None; } +static PyObject * +_wrap_test_value_array(PyObject *self, PyObject *args) +{ + GValue tvalue = {0,}, *value = &tvalue; + PyObject *obj; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + + g_value_init(value, G_TYPE_VALUE_ARRAY); + if (pyg_value_from_pyobject(value, obj)) { + PyErr_SetString(PyExc_TypeError, "Could not convert to GValueArray"); + return NULL; + } + + return pyg_value_as_pyobject(value, FALSE); +} + static PyMethodDef testhelper_functions[] = { { "get_test_thread", (PyCFunction)_wrap_get_test_thread, METH_NOARGS }, { "get_unknown", (PyCFunction)_wrap_get_unknown, METH_NOARGS }, { "create_test_type", (PyCFunction)_wrap_create_test_type, METH_NOARGS }, { "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 }, { NULL, NULL } }; |