mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
Fix dynamic attribute inheritance in C++
`PyType_Ready` would usually perform the inheritance for us, but it can't adjust `tp_basicsize` appropriately.
This commit is contained in:
@@ -59,6 +59,8 @@ public:
|
||||
~DynamicClass() { print_destroyed(this); }
|
||||
};
|
||||
|
||||
class CppDerivedDynamicClass : public DynamicClass { };
|
||||
|
||||
test_initializer methods_and_attributes([](py::module &m) {
|
||||
py::class_<ExampleMandA>(m, "ExampleMandA")
|
||||
.def(py::init<>())
|
||||
@@ -90,4 +92,7 @@ test_initializer methods_and_attributes([](py::module &m) {
|
||||
|
||||
py::class_<DynamicClass>(m, "DynamicClass", py::dynamic_attr())
|
||||
.def(py::init());
|
||||
|
||||
py::class_<CppDerivedDynamicClass, DynamicClass>(m, "CppDerivedDynamicClass")
|
||||
.def(py::init());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user