Booleans in Python are implemented as a subclass of integers. There are only two booleans,
and
. As such, the normal creation and deletion functions don’t apply to booleans. The following macros are available, however.
PyBool_Type
Part of the
.This instance of
represents the Python boolean type; it is the same object as
in the Python layer.
intPyBool_Check(
*o)
Return true if o is of type
. This function always succeeds.
*Py_False
The Python False object. This object has no methods and is
.
Changed in version 3.12:
is
.
*Py_True
The Python True object. This object has no methods and is
.
Changed in version 3.12:
is
.
Py_RETURN_FALSE
Return
from a function.
Py_RETURN_TRUE
Return
from a function.
*PyBool_FromLong(longv)
Return value: New reference. Part of the
.Return
or
, depending on the truth value of v.