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:
parent
570e911f4e
commit
c86acd3f18
3 changed files with 4 additions and 8 deletions
|
@ -220,14 +220,12 @@ convert_field (struct type *type, int field)
|
|||
if (PyObject_SetAttrString (result.get (), "name", arg.get ()) < 0)
|
||||
return NULL;
|
||||
|
||||
arg = gdbpy_ref<>::new_reference (TYPE_FIELD_ARTIFICIAL (type, field)
|
||||
? Py_True : Py_False);
|
||||
arg.reset (PyBool_FromLong (TYPE_FIELD_ARTIFICIAL (type, field)));
|
||||
if (PyObject_SetAttrString (result.get (), "artificial", arg.get ()) < 0)
|
||||
return NULL;
|
||||
|
||||
if (type->code () == TYPE_CODE_STRUCT)
|
||||
arg = gdbpy_ref<>::new_reference (field < TYPE_N_BASECLASSES (type)
|
||||
? Py_True : Py_False);
|
||||
arg.reset (PyBool_FromLong (field < TYPE_N_BASECLASSES (type)));
|
||||
else
|
||||
arg = gdbpy_ref<>::new_reference (Py_False);
|
||||
if (PyObject_SetAttrString (result.get (), "is_base_class", arg.get ()) < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue