Skip to content

Commit 66fb327

Browse files
committed
Material: Return new reference to Python boolean
1 parent 441b1d2 commit 66fb327

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Mod/Material/App/MaterialPyImpl.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ PyObject* MaterialPy::hasPhysicalModel(PyObject* args)
222222
}
223223

224224
bool hasProperty = getMaterialPtr()->hasPhysicalModel(QString::fromStdString(uuid));
225-
return hasProperty ? Py_True : Py_False;
225+
return PyBool_FromLong(hasProperty ? 1 : 0);
226226
}
227227

228228
PyObject* MaterialPy::hasAppearanceModel(PyObject* args)
@@ -233,7 +233,7 @@ PyObject* MaterialPy::hasAppearanceModel(PyObject* args)
233233
}
234234

235235
bool hasProperty = getMaterialPtr()->hasAppearanceModel(QString::fromStdString(uuid));
236-
return hasProperty ? Py_True : Py_False;
236+
return PyBool_FromLong(hasProperty ? 1 : 0);
237237
}
238238

239239
PyObject* MaterialPy::isPhysicalModelComplete(PyObject* args)
@@ -244,7 +244,7 @@ PyObject* MaterialPy::isPhysicalModelComplete(PyObject* args)
244244
}
245245

246246
bool isComplete = getMaterialPtr()->isPhysicalModelComplete(QString::fromStdString(name));
247-
return isComplete ? Py_True : Py_False;
247+
return PyBool_FromLong(isComplete ? 1 : 0);
248248
}
249249

250250
PyObject* MaterialPy::isAppearanceModelComplete(PyObject* args)
@@ -255,7 +255,7 @@ PyObject* MaterialPy::isAppearanceModelComplete(PyObject* args)
255255
}
256256

257257
bool isComplete = getMaterialPtr()->isAppearanceModelComplete(QString::fromStdString(name));
258-
return isComplete ? Py_True : Py_False;
258+
return PyBool_FromLong(isComplete ? 1 : 0);
259259
}
260260

261261
PyObject* MaterialPy::hasPhysicalProperty(PyObject* args)
@@ -266,7 +266,7 @@ PyObject* MaterialPy::hasPhysicalProperty(PyObject* args)
266266
}
267267

268268
bool hasProperty = getMaterialPtr()->hasPhysicalProperty(QString::fromStdString(name));
269-
return hasProperty ? Py_True : Py_False;
269+
return PyBool_FromLong(hasProperty ? 1 : 0);
270270
}
271271

272272
PyObject* MaterialPy::hasAppearanceProperty(PyObject* args)
@@ -277,7 +277,7 @@ PyObject* MaterialPy::hasAppearanceProperty(PyObject* args)
277277
}
278278

279279
bool hasProperty = getMaterialPtr()->hasAppearanceProperty(QString::fromStdString(name));
280-
return hasProperty ? Py_True : Py_False;
280+
return PyBool_FromLong(hasProperty ? 1 : 0);
281281
}
282282

283283
Py::Dict MaterialPy::getProperties() const

0 commit comments

Comments
 (0)