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

@ -426,8 +426,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
}
PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
bool_obj = (is_a_field_of_this.type != NULL) ? Py_True : Py_False;
Py_INCREF (bool_obj);
bool_obj = PyBool_FromLong (is_a_field_of_this.type != NULL);
PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
return ret_tuple.release ();