git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8860 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-22 06:27:47 +00:00
commit 51537af05a

View file

@ -4416,10 +4416,12 @@ arrays of different sizes. To do this, you might write a typemap as follows:
for (i =0; i < $1_dim0; i++) {
PyObject *o = PySequence_GetItem($input,i);
if (!PyFloat_Check(o)) {
Py_XDECREF(o);
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
return NULL;
}
temp[i] = PyFloat_AsDouble(o);
Py_DECREF(o);
}
$1 = &temp[0];
}
@ -4460,10 +4462,12 @@ static int convert_darray(PyObject *input, double *ptr, int size) {
for (i =0; i < size; i++) {
PyObject *o = PySequence_GetItem(input,i);
if (!PyFloat_Check(o)) {
Py_XDECREF(o);
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
return 0;
}
ptr[i] = PyFloat_AsDouble(o);
Py_DECREF(o);
}
return 1;
}