Correct Python docs example
Fix PyTuple_SetItem in argout typemap Fix from Bob Hood on swig-user mailing list [skip ci]
This commit is contained in:
parent
e0728f582a
commit
a8110e3761
1 changed files with 16 additions and 16 deletions
|
|
@ -4891,23 +4891,23 @@ A typemap can be used to handle this case as follows :
|
|||
// is guaranteed to be a List object by SWIG.
|
||||
|
||||
%typemap(argout) double *OutValue {
|
||||
PyObject *o, *o2, *o3;
|
||||
o = PyFloat_FromDouble(*$1);
|
||||
if ((!$result) || ($result == Py_None)) {
|
||||
$result = o;
|
||||
} else {
|
||||
if (!PyTuple_Check($result)) {
|
||||
PyObject *o2 = $result;
|
||||
$result = PyTuple_New(1);
|
||||
PyTuple_SetItem(target,0,o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3,0,o);
|
||||
o2 = $result;
|
||||
$result = PySequence_Concat(o2,o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
PyObject *o, *o2, *o3;
|
||||
o = PyFloat_FromDouble(*$1);
|
||||
if ((!$result) || ($result == Py_None)) {
|
||||
$result = o;
|
||||
} else {
|
||||
if (!PyTuple_Check($result)) {
|
||||
PyObject *o2 = $result;
|
||||
$result = PyTuple_New(1);
|
||||
PyTuple_SetItem($result,0,o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3,0,o);
|
||||
o2 = $result;
|
||||
$result = PySequence_Concat(o2,o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
}
|
||||
|
||||
int spam(double a, double b, double *OutValue, double *OutValue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue