Skip to content

Commit

Permalink
do not allow to delete properties in FeaturePythonPyT
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 10, 2016
1 parent f345501 commit 025cf18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/App/FeaturePythonPyImp.h
Expand Up @@ -24,7 +24,7 @@
#define APP_FEATUREPYTHONPYIMP_H

#include <Base/BaseClass.h>
#include <Base/PyObjectBase.h>
#include <App/PropertyContainerPy.h>

namespace App
{
Expand Down
6 changes: 6 additions & 0 deletions src/App/FeaturePythonPyImp.inl
Expand Up @@ -113,6 +113,12 @@ int FeaturePythonPyT<FeaturePyT>::__setattr(PyObject *obj, char *attr, PyObject
template<class FeaturePyT>
int FeaturePythonPyT<FeaturePyT>::_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;
Expand Down

0 comments on commit 025cf18

Please sign in to comment.