diff --git a/src/App/FeaturePythonPyImp.h b/src/App/FeaturePythonPyImp.h index a9ab3a352..4e72f013d 100644 --- a/src/App/FeaturePythonPyImp.h +++ b/src/App/FeaturePythonPyImp.h @@ -24,7 +24,7 @@ #define APP_FEATUREPYTHONPYIMP_H #include -#include +#include namespace App { diff --git a/src/App/FeaturePythonPyImp.inl b/src/App/FeaturePythonPyImp.inl index 3c021d794..a71e47606 100644 --- a/src/App/FeaturePythonPyImp.inl +++ b/src/App/FeaturePythonPyImp.inl @@ -113,6 +113,12 @@ int FeaturePythonPyT::__setattr(PyObject *obj, char *attr, PyObject template int FeaturePythonPyT::_setattr(char *attr, PyObject *value) { + App::Property *prop = FeaturePyT::getPropertyContainerPtr()->getPropertyByName(attr); + if (prop && !value) { + PyErr_Format(PyExc_AttributeError, "Cannot delete attribute: '%s'", attr); + return -1; + } + int returnValue = FeaturePyT::_setattr(attr, value); if (returnValue == -1) { PyObject* dict_item = value;