[C++-sig] conversion of std::list<...> parameters in function call

Achim Domma achim.domma at syynx.de
Sat Jun 22 19:26:32 CEST 2002


Hi Ralf,

it works for my problem, thanks a lot! I reduced it to the parts required
for converting lists, and it seems, that everyting I didn't understand was
not necessary for me! ;-)

Could you please have a look at the following function? Do I have to call
Py_INCREF for the obj in the PyTuple_Check branch?

namespace bpl_utils {
  boost::python::tuple
  list_or_tuple_as_tuple(PyObject* obj)
  {
    using namespace boost::python;
    tuple result;
    if      (PyList_Check(obj)) {
      result = tuple(PyList_AsTuple(obj));
    }
    else if (PyTuple_Check(obj)) {
        //  Py_INCREF ???
      result = tuple(obj);
    }
    // else XXX!?!
    return result;
  }
}

Is it ok to use this code in my (free) ImageMagick wrapper, if I mark it as
based on work copyrighted by you and your university, or is there a license
probem?

greetings
Achim







More information about the Cplusplus-sig mailing list