Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
boolobject.h55 linesDownload Raw Back to include
1/* Boolean object interface */2 3#ifndef Py_BOOLOBJECT_H4#define Py_BOOLOBJECT_H5#ifdef __cplusplus6extern "C" {7#endif8 9 10// PyBool_Type is declared by object.h11 12#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)13 14/* Py_False and Py_True are the only two bools in existence. */15 16/* Don't use these directly */17PyAPI_DATA(PyLongObject) _Py_FalseStruct;18PyAPI_DATA(PyLongObject) _Py_TrueStruct;19 20/* Use these macros */21#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030D000022#  define Py_False Py_GetConstantBorrowed(Py_CONSTANT_FALSE)23#  define Py_True Py_GetConstantBorrowed(Py_CONSTANT_TRUE)24#else25#  define Py_False _PyObject_CAST(&_Py_FalseStruct)26#  define Py_True _PyObject_CAST(&_Py_TrueStruct)27#endif28 29// Test if an object is the True singleton, the same as "x is True" in Python.30PyAPI_FUNC(int) Py_IsTrue(PyObject *x);31#define Py_IsTrue(x) Py_Is((x), Py_True)32 33// Test if an object is the False singleton, the same as "x is False" in Python.34PyAPI_FUNC(int) Py_IsFalse(PyObject *x);35#define Py_IsFalse(x) Py_Is((x), Py_False)36 37/* Macros for returning Py_True or Py_False, respectively.38 * Only treat Py_True and Py_False as immortal in the limited C API 3.1239 * and newer. */40#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030c000041#  define Py_RETURN_TRUE return Py_NewRef(Py_True)42#  define Py_RETURN_FALSE return Py_NewRef(Py_False)43#else44#  define Py_RETURN_TRUE return Py_True45#  define Py_RETURN_FALSE return Py_False46#endif47 48/* Function to return a bool from a C long */49PyAPI_FUNC(PyObject *) PyBool_FromLong(long);50 51#ifdef __cplusplus52}53#endif54#endif /* !Py_BOOLOBJECT_H */55 
codekingpro/portable-devtools · Team Ai