Gui: Use PyObject_IsTrue in combination with conditional ternary operator

This commit is contained in:
marioalexis
2022-05-17 12:41:58 -03:00
committed by Chris Hennes
parent 80492e81fa
commit ae56fb62a7
8 changed files with 35 additions and 34 deletions

View File

@@ -258,7 +258,7 @@ Py::Object MDIViewPy::getActiveObject(const Py::Tuple& args)
{
const char* name;
PyObject *resolve = Py_True;
if (!PyArg_ParseTuple(args.ptr(), "s|O", &name,&resolve))
if (!PyArg_ParseTuple(args.ptr(), "s|O!", &name, &PyBool_Type, &resolve))
throw Py::Exception();
App::DocumentObject *parent = nullptr;
@@ -269,7 +269,7 @@ Py::Object MDIViewPy::getActiveObject(const Py::Tuple& args)
if (!obj)
return Py::None();
if (PyObject_IsTrue(resolve))
if (PyObject_IsTrue(resolve) ? true : false)
return Py::asObject(obj->getPyObject());
return Py::TupleN(