Skip to content

Commit d69ffaf

Browse files
committed
std: fix return policy
1 parent 817bf2f commit d69ffaf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/eigenpy/std-array.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct StdArrayPythonVisitor {
141141
.def(visitor)
142142
.def("tolist", tolist, bp::arg("self"),
143143
"Returns the std::array as a Python list.",
144-
bp::return_internal_reference<>());
144+
bp::with_custodian_and_ward_postcall<0, 1>());
145145
}
146146
}
147147
};

include/eigenpy/std-vector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ struct ExposeStdMethodToStdVector
388388
cl.def(m_co_visitor)
389389
.def("tolist", &FromPythonListConverter::tolist, bp::arg("self"),
390390
"Returns the std::vector as a Python list.",
391-
bp::return_internal_reference<>())
391+
bp::with_custodian_and_ward_postcall<0, 1>())
392392
.def("reserve", &Container::reserve,
393393
(bp::arg("self"), bp::arg("new_cap")),
394394
"Increase the capacity of the vector to a value that's greater "

0 commit comments

Comments
 (0)