From 3789a2601442e0aef039878a3bddc41f7afea1e1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 3 Jun 2019 18:40:45 +0200 Subject: [PATCH] add define to inactivate some code blocks if needed --- src/Base/PyObjectBase.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index eecb4ce7e5ce..2d8e684bd7ef 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -32,6 +32,8 @@ #include "Console.h" #include "Interpreter.h" +#define ATTR_TRACKING + using namespace Base; PyObject* Base::BaseExceptionFreeCADError = 0; @@ -164,6 +166,7 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro) return NULL; } +#ifdef ATTR_TRACKING // If an attribute references this as parent then reset it (bug #0002902) PyObject* cur = pyObj->getTrackedAttribute(attr); if (cur) { @@ -173,9 +176,10 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro) pyObj->untrackAttribute(attr); } } +#endif PyObject* value = pyObj->_getattr(attr); -#if 1 +#ifdef ATTR_TRACKING if (value && PyObject_TypeCheck(value, &(PyObjectBase::Type))) { if (!static_cast(value)->isConst() && !static_cast(value)->isNotTracking()) { @@ -223,6 +227,7 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value) return -1; } +#ifdef ATTR_TRACKING // If an attribute references this as parent then reset it // before setting the new attribute PyObject* cur = static_cast(obj)->getTrackedAttribute(attr); @@ -233,9 +238,10 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value) static_cast(obj)->untrackAttribute(attr); } } +#endif int ret = static_cast(obj)->_setattr(attr, value); -#if 1 +#ifdef ATTR_TRACKING if (ret == 0) { static_cast(obj)->startNotify(); }