Skip to content

Commit

Permalink
Py3: fix crash if class is not part of a module any more
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 2, 2019
1 parent 0c429e3 commit ed47e96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App/PropertyPythonObject.cpp
Expand Up @@ -333,6 +333,12 @@ void PropertyPythonObject::Restore(Base::XMLReader &reader)
if (mod.isNull())
throw Py::Exception();
PyObject* cls = mod.getAttr(reader.getAttribute("class")).ptr();
if (!cls) {
std::stringstream s;
s << "Module " << reader.getAttribute("module")
<< " has no class " << reader.getAttribute("class");
throw Py::AttributeError(s.str());
}
#if PY_MAJOR_VERSION >= 3
if (PyType_Check(cls)) {
#else
Expand Down

0 comments on commit ed47e96

Please sign in to comment.