diff --git a/src/App/PropertyContainerPyImp.cpp b/src/App/PropertyContainerPyImp.cpp index 488abc52dd..7960ae8ada 100644 --- a/src/App/PropertyContainerPyImp.cpp +++ b/src/App/PropertyContainerPyImp.cpp @@ -482,14 +482,12 @@ PyObject *PropertyContainerPy::getCustomAttributes(const char* attr) const } Property *prop = getPropertyContainerPtr()->getPropertyByName(attr); if (prop) { - PY_TRY { - PyObject* pyobj = prop->getPyObject(); - if (!pyobj && PyErr_Occurred()) { - // the Python exception is already set - throw Py::Exception(); - } - return pyobj; - }PY_CATCH + PyObject* pyobj = prop->getPyObject(); + if (!pyobj && PyErr_Occurred()) { + // the Python exception is already set + throw Py::Exception(); + } + return pyobj; } else if (Base::streq(attr, "__dict__")) { // get the properties to the C++ PropertyContainer class @@ -528,7 +526,12 @@ PyObject *PropertyContainerPy::getCustomAttributes(const char* attr) const if(_getShape != Py_None) { Py::Tuple args(1); args.setItem(0,Py::Object(const_cast(this))); - return PyObject_CallObject(_getShape, args.ptr()); + Py::Object res(PyObject_CallObject(_getShape, args.ptr()),true); + if(res.hasAttr("isNull")) { + Py::Callable func(res.getAttr("isNull")); + if(!func.apply().isTrue()) + return Py::new_reference_to(res); + } } }