Hello, I have a function that expects as argument a boost::python::object and 
such function can be
used by python world.
The function works like this:

bool function(boost::python::object &object)
{
         // ...

         XPTO * & x = boost::python::extract<XPTO * & >(object);

// ...

x = nullptr;

}

That is, the argument used in the python world will be a None after calling 
this function.
Ok, that is working when I call from python.

But the project has a lot of tests (using GTest) and the test verifying
nullptr after calling this function is failing and happens fullly in C++ world.

I am trying to do this:

XPTO* x;
// ...

boost::python::reference_existing_object::apply<XPTO * &>::type converter;
boost::python::object object(boost::python::handle(converter(x)));
XPTO * & y = boost::python::extract<XPTO * & >(object);

I can see in debugger:
x == y
The problem is:
&x != &y when they should be equal in order to the function to be able to 
change the pointer to
nullptr doing y = nullptr.


I am trying this for hours; I really appreciate any suggestion or help. Thank 
you.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to