You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is a pybind11 problem or not, but it fails to import when there are nested classes with the same name but in different scopes.
The following code builds fine with no errors, but only import error happens. If the second "Option" (for Derived::Option) is renamed to something else, then the import error disappears.
I believe this binding code is legitimate because it works in equivalent Python code.
Duplicate of #1624. The problem is that pybind11 sees that hasattr(Derived, "Option") (namely in Base). Temporary (but ugly) workaround is the following:
auto base = py::class_<Base>(m, "Base").def(py::init<>());
auto derived = py::class_<Derived, Base>(m, "Derived").def(py::init<>());
py::class_<Derived::Option, Base::Option>(derived, "Option").def(py::init<>());
py::class_<Base::Option>(base, "Option").def(py::init<>());
I am thinking about/working on a fix. Closing this as duplicate; follow #1624 instead.
Issue description
Not sure if this is a pybind11 problem or not, but it fails to import when there are nested classes with the same name but in different scopes.
The following code builds fine with no errors, but only import error happens. If the second "Option" (for
Derived::Option
) is renamed to something else, then the import error disappears.I believe this binding code is legitimate because it works in equivalent Python code.
Reproducible example code
The text was updated successfully, but these errors were encountered: