-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Binding two maps with two different integer key types failues due to duplicate KeyViews #4529
Comments
The same issue also appear if one attempts to bind both map to #include <map>
#include <pybind11/pybind11.h>
#include <pybind11/stl_bind.h>
PYBIND11_MODULE(example, m)
{
// leads to ImportError: generic_type: cannot initialize type "ValuesView[float]": an object with that name is already defined
pybind11::bind_map< std::map<std::string,float> >(m, "map_string_float" );
pybind11::bind_map< std::map<std::string,double> >(m, "map_string_double" );
}
|
And needless to say this also breaks our build, so this is a real issue. Interrestingly we also run into this:
ArrayInt2 is a binding for Everything works fine in 2.10.1. |
Are there any updates on this? It also breaks a few of my projects, see https://github.com/conda-forge/pycolmap-feedstock/issues |
…nt32_t or float/double. Fix pybind#4529
…nt32_t or float/double. Fix pybind#4529
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
3cc7e42
Problem description
The attached example code binds two map types:
std::map<uint16_t, uint16_t>
andstd::map<uint32_t, uint16_t>
.With recent pybind11 this fails when importing with:
Looking at the relevant code:
pybind11/include/pybind11/stl_bind.h
Line 733 in 3cc7e42
checks whether a matching key typeid has been wrapped already; but in this case two different typeids have the same string name in pybind11.
This is breaking a project that happens to use this; if there's a workaround other than unifying the map key types that fixes things with recent pybind11 releases that would also be useful to know.
Thanks for your help!
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Believe this was broken by 9db9880. 2.10.0 was known working.
The text was updated successfully, but these errors were encountered: