From christiano.sa at outlook.com Sun Oct 18 03:36:28 2020 From: christiano.sa at outlook.com (Christiano Scarpati Alvarenga) Date: Sun, 18 Oct 2020 07:36:28 +0000 Subject: [C++-sig] Reference to pointer from C++ to Python Message-ID: 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(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::type converter; boost::python::object object(boost::python::handle(converter(x))); XPTO * & y = boost::python::extract(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. -------------- next part -------------- An HTML attachment was scrubbed... URL: