Issue #7466: segmentation fault when the garbage collector is called
[python.git] / Include / boolobject.h
blob74e854f706bcc83a32b95861199c5fe3025777da
1 /* Boolean object interface */
3 #ifndef Py_BOOLOBJECT_H
4 #define Py_BOOLOBJECT_H
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
10 typedef PyIntObject PyBoolObject;
12 PyAPI_DATA(PyTypeObject) PyBool_Type;
14 #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
16 /* Py_False and Py_True are the only two bools in existence.
17 Don't forget to apply Py_INCREF() when returning either!!! */
19 /* Don't use these directly */
20 PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
22 /* Use these macros */
23 #define Py_False ((PyObject *) &_Py_ZeroStruct)
24 #define Py_True ((PyObject *) &_Py_TrueStruct)
26 /* Macros for returning Py_True or Py_False, respectively */
27 #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
28 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
30 /* Function to return a bool from a C long */
31 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
33 #ifdef __cplusplus
35 #endif
36 #endif /* !Py_BOOLOBJECT_H */