Use PyObject_IsTrue to check argument
This commit is contained in:
@@ -187,7 +187,9 @@ PyObject* DocumentPy::copyObject(PyObject *args)
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj);
|
||||
DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(), rec==Py_True, keep==Py_True);
|
||||
DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(),
|
||||
PyObject_IsTrue(rec) ? true : false,
|
||||
PyObject_IsTrue(keep)? true : false);
|
||||
if (copy) {
|
||||
return copy->getPyObject();
|
||||
}
|
||||
@@ -204,7 +206,7 @@ PyObject* DocumentPy::moveObject(PyObject *args)
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj);
|
||||
DocumentObject* move = getDocumentPtr()->moveObject(docObj->getDocumentObjectPtr(), rec==Py_True);
|
||||
DocumentObject* move = getDocumentPtr()->moveObject(docObj->getDocumentObjectPtr(), PyObject_IsTrue(rec) ? true : false);
|
||||
if (move) {
|
||||
return move->getPyObject();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ PyObject* FeaturePythonPy::addProperty(PyObject *args)
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
Property* prop=0;
|
||||
prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,ro==Py_True,hd==Py_True);
|
||||
prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,
|
||||
PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false);
|
||||
|
||||
if (!prop) {
|
||||
std::stringstream str;
|
||||
|
||||
@@ -1347,7 +1347,7 @@ PyObject *PropertyBool::getPyObject(void)
|
||||
void PropertyBool::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyBool_Check(value))
|
||||
setValue(value == Py_True);
|
||||
setValue(PyObject_IsTrue(value)!=0);
|
||||
else if(PyInt_Check(value))
|
||||
setValue(PyInt_AsLong(value)!=0);
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user