Skip to content

Commit cb5e0b0

Browse files
committed
Cannot deal with unknown attribute because some are dealt with by the factory itself (e.g. src, template, input...)
1 parent 2dd1743 commit cb5e0b0

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,15 @@ py::object addObjectKwargs(Node* self, const std::string& type, const py::kwargs
291291

292292
for(auto a : kwargs)
293293
{
294-
BaseData* d = object->findData(py::cast<std::string>(a.first));
295-
if(d)
294+
const std::string dataName = py::cast<std::string>(a.first);
295+
BaseData * d = object->findData(dataName);
296+
if (d)
296297
{
297298
if (parametersToLink.contains(a.first))
298299
d->setParent(a.second.cast<BaseData*>());
299300
else if(parametersToCopy.contains(a.first))
300301
PythonFactory::fromPython(d, py::cast<py::object>(a.second));
301302
d->setPersistent(true);
302-
}else
303-
{
304-
throw py::type_error("Unknown Attribute: '"+py::cast<std::string>(a.first)+"'");
305303
}
306304
}
307305
return PythonFactory::toPython(object.get());

0 commit comments

Comments
 (0)