Modify PropertyLinkList to accept None from Python.

This commit is contained in:
Chris Hennes
2020-11-16 15:20:24 -06:00
committed by wmayer
parent deab8fc965
commit e222461e85

View File

@@ -716,8 +716,10 @@ PyObject *PropertyLinkList::getPyObject(void)
}
DocumentObject *PropertyLinkList::getPyValue(PyObject *item) const {
if (!PyObject_TypeCheck(item, &(DocumentObjectPy::Type))) {
std::string error = std::string("type must be 'DocumentObject' or list of 'DocumentObject', not ");
if (item == Py_None) {
return nullptr;
} else if (!PyObject_TypeCheck(item, &(DocumentObjectPy::Type))) {
std::string error = std::string("type must be 'DocumentObject', list of 'DocumentObject', or NoneType, not ");
error += item->ob_type->tp_name;
throw Base::TypeError(error);
}