Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:48

0001 /* Boolean object interface */
0002 
0003 #ifndef Py_BOOLOBJECT_H
0004 #define Py_BOOLOBJECT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008 
0009 
0010 // PyBool_Type is declared by object.h
0011 
0012 #define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
0013 
0014 /* Py_False and Py_True are the only two bools in existence. */
0015 
0016 /* Don't use these directly */
0017 PyAPI_DATA(PyLongObject) _Py_FalseStruct;
0018 PyAPI_DATA(PyLongObject) _Py_TrueStruct;
0019 
0020 /* Use these macros */
0021 #define Py_False _PyObject_CAST(&_Py_FalseStruct)
0022 #define Py_True _PyObject_CAST(&_Py_TrueStruct)
0023 
0024 // Test if an object is the True singleton, the same as "x is True" in Python.
0025 PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
0026 #define Py_IsTrue(x) Py_Is((x), Py_True)
0027 
0028 // Test if an object is the False singleton, the same as "x is False" in Python.
0029 PyAPI_FUNC(int) Py_IsFalse(PyObject *x);
0030 #define Py_IsFalse(x) Py_Is((x), Py_False)
0031 
0032 /* Macros for returning Py_True or Py_False, respectively */
0033 #define Py_RETURN_TRUE return Py_True
0034 #define Py_RETURN_FALSE return Py_False
0035 
0036 /* Function to return a bool from a C long */
0037 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
0038 
0039 #ifdef __cplusplus
0040 }
0041 #endif
0042 #endif /* !Py_BOOLOBJECT_H */