Files
RedBear-OS/recipes/dev/python312/source/Doc/c-api/bool.rst
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

57 lines
1.3 KiB
ReStructuredText

.. highlight:: c
.. _boolobjects:
Boolean Objects
---------------
Booleans in Python are implemented as a subclass of integers. There are only
two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal
creation and deletion functions don't apply to booleans. The following macros
are available, however.
.. c:var:: PyTypeObject PyBool_Type
This instance of :c:type:`PyTypeObject` represents the Python boolean type; it
is the same object as :class:`bool` in the Python layer.
.. c:function:: int PyBool_Check(PyObject *o)
Return true if *o* is of type :c:data:`PyBool_Type`. This function always
succeeds.
.. c:var:: PyObject* Py_False
The Python ``False`` object. This object has no methods and is
`immortal <https://peps.python.org/pep-0683/>`_.
.. versionchanged:: 3.12
:c:data:`Py_False` is immortal.
.. c:var:: PyObject* Py_True
The Python ``True`` object. This object has no methods and is
`immortal <https://peps.python.org/pep-0683/>`_.
.. versionchanged:: 3.12
:c:data:`Py_True` is immortal.
.. c:macro:: Py_RETURN_FALSE
Return :c:data:`Py_False` from a function.
.. c:macro:: Py_RETURN_TRUE
Return :c:data:`Py_True` from a function.
.. c:function:: PyObject* PyBool_FromLong(long v)
Return :c:data:`Py_True` or :c:data:`Py_False`, depending on the truth value of *v*.