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));
}
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 ();
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)