diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index ebbf9474..e98adbb2 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -168,7 +168,9 @@ template struct constructor { auto *cl_type = get_type_info(typeid(Cpp)); cl.def("__init__", [cl_type](handle self_, Args... args) { auto v_h = load_v_h(self_, cl_type); - if (v_h.instance_registered()) return; // Ignore duplicate __init__ calls (see above) + // If this value is already registered it must mean __init__ is invoked multiple times; + // we really can't support that in C++, so just ignore the second __init__. + if (v_h.instance_registered()) return; construct(v_h, new Cpp(std::forward(args)...), false); }, extra...);