There is no predefined format character for this conversion, but it is trivial to simulate it by inserting an object into the tuple Py_Trueor Py_False, if necessary. For example:
int i = ...;
bool b = ...;
PyObject *tuple_with_bool = Py_BuildValue("Oi", b ? Py_True: Py_False, i);
- PyBool_FromLong . N PyBool_FromLong, :
PyObject *tuple_with_bool = Py_BuildValue("Ni", PyBool_FromLong(b), i);