Use PyBool_FromLong

I noticed a few spots that were explicitly creating new references to
Py_True or Py_False.  It's simpler here to use PyBool_FromLong, so
this patch changes all the places I found.
This commit is contained in:
Tom Tromey 2022-06-07 09:15:24 -06:00
parent 570e911f4e
commit c86acd3f18
3 changed files with 4 additions and 8 deletions

View file

@ -128,8 +128,7 @@ cmdpy_function (const char *args, int from_tty, cmd_list_element *command)
error (_("Could not convert arguments to Python string."));
}
gdbpy_ref<> ttyobj
= gdbpy_ref<>::new_reference (from_tty ? Py_True : Py_False);
gdbpy_ref<> ttyobj (PyBool_FromLong (from_tty));
gdbpy_ref<> result (PyObject_CallMethodObjArgs ((PyObject *) obj, invoke_cst,
argobj.get (), ttyobj.get (),
NULL));