File indexing completed on 2025-11-19 09:50:53
0001
0002
0003 #ifndef Py_BOOLOBJECT_H
0004 #define Py_BOOLOBJECT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008
0009
0010
0011
0012 #define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
0013
0014
0015
0016
0017 PyAPI_DATA(PyLongObject) _Py_FalseStruct;
0018 PyAPI_DATA(PyLongObject) _Py_TrueStruct;
0019
0020
0021 #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030D0000
0022 # define Py_False Py_GetConstantBorrowed(Py_CONSTANT_FALSE)
0023 # define Py_True Py_GetConstantBorrowed(Py_CONSTANT_TRUE)
0024 #else
0025 # define Py_False _PyObject_CAST(&_Py_FalseStruct)
0026 # define Py_True _PyObject_CAST(&_Py_TrueStruct)
0027 #endif
0028
0029
0030 PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
0031 #define Py_IsTrue(x) Py_Is((x), Py_True)
0032
0033
0034 PyAPI_FUNC(int) Py_IsFalse(PyObject *x);
0035 #define Py_IsFalse(x) Py_Is((x), Py_False)
0036
0037
0038
0039
0040 #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030c0000
0041 # define Py_RETURN_TRUE return Py_NewRef(Py_True)
0042 # define Py_RETURN_FALSE return Py_NewRef(Py_False)
0043 #else
0044 # define Py_RETURN_TRUE return Py_True
0045 # define Py_RETURN_FALSE return Py_False
0046 #endif
0047
0048
0049 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
0050
0051 #ifdef __cplusplus
0052 }
0053 #endif
0054 #endif