fix bug #1094964
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8860 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e99a8a707f
commit
51537af05a
1 changed files with 4 additions and 0 deletions
|
|
@ -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++) {
|
for (i =0; i < $1_dim0; i++) {
|
||||||
PyObject *o = PySequence_GetItem($input,i);
|
PyObject *o = PySequence_GetItem($input,i);
|
||||||
if (!PyFloat_Check(o)) {
|
if (!PyFloat_Check(o)) {
|
||||||
|
Py_XDECREF(o);
|
||||||
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
|
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
temp[i] = PyFloat_AsDouble(o);
|
temp[i] = PyFloat_AsDouble(o);
|
||||||
|
Py_DECREF(o);
|
||||||
}
|
}
|
||||||
$1 = &temp[0];
|
$1 = &temp[0];
|
||||||
}
|
}
|
||||||
|
|
@ -4460,10 +4462,12 @@ static int convert_darray(PyObject *input, double *ptr, int size) {
|
||||||
for (i =0; i < size; i++) {
|
for (i =0; i < size; i++) {
|
||||||
PyObject *o = PySequence_GetItem(input,i);
|
PyObject *o = PySequence_GetItem(input,i);
|
||||||
if (!PyFloat_Check(o)) {
|
if (!PyFloat_Check(o)) {
|
||||||
|
Py_XDECREF(o);
|
||||||
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
|
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ptr[i] = PyFloat_AsDouble(o);
|
ptr[i] = PyFloat_AsDouble(o);
|
||||||
|
Py_DECREF(o);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue