• Dean Moldovan's avatar
    Make all classes with the same instance size derive from a common base · 08cbe8df
    Dean Moldovan authored
    In order to fully satisfy Python's inheritance type layout requirements,
    all types should have a common 'solid' base. A solid base is one which
    has the same instance size as the derived type (not counting the space
    required for the optional `dict_ptr` and `weakrefs_ptr`). Thus, `object`
    does not qualify as a solid base for pybind11 types and this can lead to
    issues with multiple inheritance.
    
    To get around this, new base types are created: one per unique instance
    size. There is going to be very few of these bases. They ensure Python's
    MRO checks will pass when multiple bases are involved.
    08cbe8df
test_inheritance.cpp 3.84 KB