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
I'm trying to bind base class [[A]] to module [[m1]], subclassed by implementation class [[B]] in module [[m2]]:
NB_MODULE(MODULE_NAME, m1) {
m1.doc() = "Example binding";
m1.attr("__version__") = VERSION_INFO;
nb::class_<[[A]]> c_[[A]]= nb::class_<[[A]]>(m1, "[[A]]");
nb::module_ m2 = m.def_submodule("sub", "Submodule of m1");
// Above this line works fine!
nb::class_<[[B]], [[A]]> [[B]] = nb::class_<[[B]], [[A]]>(m2, "[[B]]");
// ^^ Fails with "extra arguments that could not be handled"!
}
Here is the relevent snip of nanobind, nb_class.h:453-465:
template <typename T, typename... Ts>
class class_ : public object {
public:
NB_OBJECT_DEFAULT(class_, object, "type", PyType_Check);
using Type = T;
using Base = typename detail::extract<T, detail::is_base, Ts...>::type;
using Alias = typename detail::extract<T, detail::is_alias, Ts...>::type;
static_assert(sizeof(Alias) < (1 << 24), "Instance size is too big!");
static_assert(alignof(Alias) < (1 << 8), "Instance alignment is too big!");
static_assert(
sizeof...(Ts) == !std::is_same_v<Base, T> + !std::is_same_v<Alias, T>,
"nanobind::class_<> was invoked with extra arguments that could not be handled");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to bind base class [[A]] to module [[m1]], subclassed by implementation class [[B]] in module [[m2]]:
Here is the relevent snip of nanobind, nb_class.h:453-465:
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions