Core: replace PyObject_IsTrue with Base::asBoolean

This commit is contained in:
wmayer
2022-07-16 14:04:05 +02:00
parent d1ef818f39
commit 201f4c9a5a
21 changed files with 68 additions and 69 deletions

View File

@@ -2065,9 +2065,9 @@ PyObject *PropertyBool::getPyObject()
void PropertyBool::setPyObject(PyObject *value)
{
if (PyBool_Check(value) || PyLong_Check(value)) {
setValue(PyObject_IsTrue(value) ? true : false);
}
if (PyBool_Check(value) || PyLong_Check(value)) {
setValue(Base::asBoolean(value));
}
else {
std::string error = std::string("type must be bool, not ");
error += value->ob_type->tp_name;
@@ -2189,7 +2189,7 @@ void PropertyBoolList::setPyObject(PyObject *value)
bool PropertyBoolList::getPyValue(PyObject *item) const {
if (PyBool_Check(item)) {
return (PyObject_IsTrue(item) ? true : false);
return Base::asBoolean(item);
} else if (PyLong_Check(item)) {
return (PyLong_AsLong(item) ? true : false);
} else {