Changed constructor override order in Pybind11 3.1.0 #6152
neworderofjamie
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
First of all, thanks for the amazing library! I have just isolated an issue that occurs when building our project with Pybind11 3.1.0 vs 3.0.4 and I was hoping for a suggestion for a workaround.
We have a class called
NumericValue, the relevant parts of which look like:This is wrapped for use in Python with:
With Pybind11 3.0.4, if you constructed a
NumericValuewith a Python integer, theint64_tconstructor was called but, with Pybind11 3.1.0, the double constructor gets called instead. At the suggestion of copilot, I have tried:int64_tconstructor:pybind11::int_valconstructor with a lambda function:.def(pybind11::init([](pybind11::int_ val){ return new Type::NumericValue(static_cast<int64_t>(val)); }), pybind11::arg("value").noconvert())Neither of which solve the problem! I am guessing this is related to #5879 but what's the correct solution here?
All reactions