[C++-sig] make_constructor, with_custodian_and_ward problems (again)

Neal Becker ndbecker2 at gmail.com
Fri Sep 14 13:42:55 CEST 2007


Hans Meine wrote:

> On Donnerstag 13 September 2007, Neal Becker wrote:
>> What's the correct way to do this?  Neither of the below .defs will
>> compile:
>> [...]
>>   class_<multi_array_ref<int,1> > ("multi_array_int_1", no_init)
>>     .def ("__init__", make_constructor (&make_array_int_1),
>> with_custodian_and_ward_postcall<0,1>())
>> .def ("__init__", make_constructor
>> (&make_array_int_1, with_custodian_and_ward_postcall<0,1>())) ;
>> }
>>
>> This same question was raised before, but I don't see a correct answer:
>> http://mail.python.org/pipermail/c++-sig/2007-June/012470.html
> 
> I was about to point you to the thread I started about the very same
> problem, but I realized last-minute that the link you posted is exactly
> that one. FWIW, I have not found a solution, but still have the same
> problem. (I.e. I live with the dangerous default_policies ATM.)
> 

Here is more info:
/usr/local/src/boost.hg/boost/python/object_core.hpp: In member
function 'void boost::python::api::object_operators<U>::visit(ClassT&,
const char*, const boost::python::detail::def_helper<DocStringT,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>&) const [with ClassT =
boost::python::class_<boost::multi_array_ref<int, 1ul>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>, DocStringT =
boost::python::with_custodian_and_ward_postcall<0ul, 1ul,
boost::python::default_call_policies>, U = boost::python::api::object]':
/usr/local/src/boost.hg/boost/python/def_visitor.hpp:43:   instantiated
from 'static void boost::python::def_visitor_access::visit(const V&,
classT&, const char*, const OptionalArgs&) [with V =
boost::python::def_visitor<boost::python::api::object>, classT =
boost::python::class_<boost::multi_array_ref<int, 1ul>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>, OptionalArgs =
boost::python::detail::def_helper<boost::python::with_custodian_and_ward_postcall<0ul,
1ul, boost::python::default_call_policies>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>]'
/usr/local/src/boost.hg/boost/python/def_visitor.hpp:74:   instantiated
from 'void boost::python::def_visitor<DerivedVisitor>::visit(classT&, const
char*, const OptionalArgs&) const [with classT =
boost::python::class_<boost::multi_array_ref<int, 1ul>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>, OptionalArgs =
boost::python::detail::def_helper<boost::python::with_custodian_and_ward_postcall<0ul,
1ul, boost::python::default_call_policies>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>, DerivedVisitor =
boost::python::api::object]'
/usr/local/src/boost.hg/boost/python/class.hpp:524:   instantiated
from 'void boost::python::class_<T, X1, X2, X3>::def_impl(T*, const char*,
LeafVisitor, const Helper&, const boost::python::def_visitor<Visitor>*)
[with T = boost::multi_array_ref<int, 1ul>, Helper =
boost::python::detail::def_helper<boost::python::with_custodian_and_ward_postcall<0ul,
1ul, boost::python::default_call_policies>,
boost::python::detail::not_specified, boost::python::detail::not_specified,
boost::python::detail::not_specified>, LeafVisitor =
boost::python::api::object, Visitor = boost::python::api::object, W =
boost::multi_array_ref<int, 1ul>, X1 =
boost::python::detail::not_specified, X2 =
boost::python::detail::not_specified, X3 =
boost::python::detail::not_specified]'
/usr/local/src/boost.hg/boost/python/class.hpp:608:   instantiated
from 'void boost::python::class_<T, X1, X2, X3>::def_maybe_overloads(const
char*, Fn, const A1&, ...) [with Fn = boost::python::api::object, A1 =
boost::python::with_custodian_and_ward_postcall<0ul, 1ul,
boost::python::default_call_policies>, W = boost::multi_array_ref<int,
1ul>, X1 = boost::python::detail::not_specified, X2 =
boost::python::detail::not_specified, X3 =
boost::python::detail::not_specified]'
/usr/local/src/boost.hg/boost/python/class.hpp:244:   instantiated
from 'boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1,
X2, X3>::def(const char*, A1, const A2&) [with A1 =
boost::python::api::object, A2 =
boost::python::with_custodian_and_ward_postcall<0ul, 1ul,
boost::python::default_call_policies>, W = boost::multi_array_ref<int,
1ul>, X1 = boost::python::detail::not_specified, X2 =
boost::python::detail::not_specified, X3 =
boost::python::detail::not_specified]'
mod/multi_array.cc:37:   instantiated from here
/usr/local/src/boost.hg/boost/python/object_core.hpp:186: error: invalid
application of 'sizeof' to incomplete
type 'boost::STATIC_ASSERTION_FAILURE<false>' 





More information about the Cplusplus-sig mailing list