Py3: fix crash if class is not part of a module any more
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user