[C++-sig] cannot return boost::python::tuple

Pearu Peterson pearu at cens.ioc.ee
Sat Jun 1 10:23:19 CEST 2002


On Thu, 30 May 2002, Ralf W. Grosse-Kunstleve wrote:

> --- David Abrahams <david.abrahams at rcn.com> wrote:
> >     template <class T>
> >     ref make_ref(T const& x)
> >     {
> >         return
> > ref(boost::python::converter::callback_to_python<T>(x).get(),
> > ref::increment_count);
> >     }
> 
> This works great.
> 
> And, cool, this works, too:
> 
>   boost::python::module("any")
>     .setattr("__version__", boost::python::make_ref("1.2.3"));

Works also here but when trying to use it for an instance of a class A:

  m.add(boost::python::class_<A>("A").def_init(boost::python::args<>()));
  m.setattr("a", make_ref(A()));

I get

  TypeError: no to_python (by-value) converter found for type

when importing the extension module.
What I am missing here?

Thanks,
	Pearu






More information about the Cplusplus-sig mailing list