Propagate py::multiple_inheritance to all children (#3650)

* Add tests demonstrating smart_holder issues with multiple inheritance

* Propagate C++ multiple inheritance markers to all children

- Makes py::multiple_inheritance only needed in base classes hidden from pybind11
This commit is contained in:
Dustin Spicuzza
2022-01-26 20:03:52 -05:00
committed by GitHub
parent bcb6d63ce9
commit ec81e8e778
3 changed files with 200 additions and 0 deletions

View File

@@ -1206,10 +1206,13 @@ protected:
if (rec.bases.size() > 1 || rec.multiple_inheritance) {
mark_parents_nonsimple(tinfo->type);
tinfo->simple_ancestors = false;
tinfo->simple_type = false;
}
else if (rec.bases.size() == 1) {
auto parent_tinfo = get_type_info((PyTypeObject *) rec.bases[0].ptr());
tinfo->simple_ancestors = parent_tinfo->simple_ancestors;
// a child of a non-simple type can never be a simple type
tinfo->simple_type = parent_tinfo->simple_type;
}
if (rec.module_local) {