From: Marcelo M. <mar...@us...> - 2004-10-02 01:42:25
|
Update of /cvsroot/swig/SWIG/Lib/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21671 Modified Files: pytuplehlp.swg Log Message: in/out fix Index: pytuplehlp.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/pytuplehlp.swg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pytuplehlp.swg 7 Sep 2004 09:26:23 -0000 1.1 --- pytuplehlp.swg 2 Oct 2004 01:42:01 -0000 1.2 *************** *** 1,28 **** ! /* Helper function to return tuples */ %fragment("t_output_helper","header") %{ ! static PyObject* t_output_helper(PyObject* target, PyObject* o) { ! PyObject* o2; ! PyObject* o3; ! ! if (!target) { ! target = o; ! } else if (target == Py_None) { ! Py_DECREF(Py_None); ! target = o; ! } else { ! o2 = target; ! target = PyTuple_New(1); ! PyTuple_SetItem(target, 0, o2); ! ! o3 = PyTuple_New(1); ! PyTuple_SetItem(o3, 0, o); ! ! o2 = target; ! target = PySequence_Concat(o2, o3); ! Py_DECREF(o2); ! Py_DECREF(o3); } ! return target; } %} --- 1,24 ---- ! /* ! Helper function to return output types, now we need to use a list ! instead of a tuple since all the other types ! (std::pair,std::vector,std::list,etc) return tuples. ! */ %fragment("t_output_helper","header") %{ ! static PyObject* t_output_helper(PyObject* target, PyObject* o) { ! if (!target) { ! target = o; ! } else if (target == Py_None) { ! Py_DECREF(target); ! target = o; ! } else { ! if (!PyList_Check(target)) { ! PyObject *o2 = target; ! target = PyList_New(1); ! PyList_SetItem(target, 0, o2); } ! PyList_Append(target,o); ! } ! return target; } %} |