openrave
openrave copied to clipboard
Gain compatibility with the stock Pybind11 (2.9.2)
Historically, we were discussing boost-1.65 compatibility in https://github.com/rdiankov/openrave/pull/625 but we forgot it after pybind11 version. So openrave cannot be built on boost::python on latest Debian even if we are able to get py2 binary.
The thing is that py::object operator[] does not accept int not size_t in the stock pybind11. So we have to use patched pybind11, which is not user-friendly.
I personally wrote the build guide to make pybind11 version somewhat user-friendly, but it caused some internal problems.
Now I tried to build openrave using the stock pybind11. It is like that casting all integer indexing by py::to_object.
I did test the compilation on both bullseye (pybind11) and stretch (boost::python), so it works at least.
However, it surely costs the readability a lot. Please reconsider about the guide availability. Removing the guide is not good idea at all.
tried to add this but operator[] cannot be global...
pybind11::detail::item_accessor operator[](const pybind11::object &o, int key) {
return o[pybind11::to_object(key)];
}
pybind11::detail::item_accessor operator[](const pybind11::object &o, size_t key) {
return o[pybind11::to_object(key)];
}
There seems like a pybind11 issue open for years https://github.com/pybind/pybind11/issues/1309
sorry guys I'm tired, about discussion about this matter, please don't come to my desk directly and please check with @lazydroid first.
let @woodychow and @tgn3000 know this matter
just to mention that https://github.com/pybind/pybind11/pull/4004 will deprecate this pull request (clarify: I want to close this #1125 without merging)
thanks, for now, let's gain compatibility with stock.