diff --git a/src/CPPScope.cxx b/src/CPPScope.cxx index e6c86c6..013e63c 100644 --- a/src/CPPScope.cxx +++ b/src/CPPScope.cxx @@ -431,6 +431,8 @@ static PyObject* meta_getattro(PyObject* pyclass, PyObject* pyname) if (attr) { // cache the result if (CPPDataMember_Check(attr)) { + if (Cppyy::IsClass(scope)) + PyType_Type.tp_setattro(pyclass, pyname, attr); PyType_Type.tp_setattro((PyObject*)Py_TYPE(pyclass), pyname, attr); Py_DECREF(attr);