@@ -431,10 +431,7 @@ static PyObject* meta_getattro(PyObject* pyclass, PyObject* pyname)
431431 if (attr) {
432432 // cache the result
433433 if (CPPDataMember_Check (attr)) {
434- if (Cppyy::IsClass (scope))
435- PyType_Type.tp_setattro (pyclass, pyname, attr);
436- else
437- PyType_Type.tp_setattro ((PyObject*)Py_TYPE (pyclass), pyname, attr);
434+ PyType_Type.tp_setattro ((PyObject*)Py_TYPE (pyclass), pyname, attr);
438435
439436 Py_DECREF (attr);
440437 // The call below goes through "dm_get"
@@ -531,13 +528,11 @@ static int meta_setattro(PyObject* pyclass, PyObject* pyname, PyObject* pyval)
531528// the C++ side, b/c there is no descriptor yet. This triggers the creation for
532529// for such data as necessary. The many checks to narrow down the specific case
533530// are needed to prevent unnecessary lookups and recursion.
534- if (((CPPScope*)pyclass)->fFlags & CPPScope::kIsNamespace ) {
535531 // skip if the given pyval is a descriptor already, or an unassignable class
536- if (!CPyCppyy::CPPDataMember_Check (pyval) && !CPyCppyy::CPPScope_Check (pyval)) {
537- std::string name = CPyCppyy_PyText_AsString (pyname);
538- if (Cppyy::GetNamed (name, ((CPPScope*)pyclass)->fCppType ))
539- meta_getattro (pyclass, pyname); // triggers creation
540- }
532+ if (!CPyCppyy::CPPDataMember_Check (pyval) && !CPyCppyy::CPPScope_Check (pyval)) {
533+ std::string name = CPyCppyy_PyText_AsString (pyname);
534+ if (Cppyy::GetNamed (name, ((CPPScope*)pyclass)->fCppType ))
535+ meta_getattro (pyclass, pyname); // triggers creation
541536 }
542537
543538 return PyType_Type.tp_setattro (pyclass, pyname, pyval);
0 commit comments