27
|
1 /* Boolean object interface */
|
|
2
|
|
3 #ifndef Py_BOOLOBJECT_H
|
|
4 #define Py_BOOLOBJECT_H
|
|
5
|
|
6 PyAPI_DATA(PyTypeObject) PyBool_Type;
|
|
7
|
|
8 #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
|
9
|
|
10 /* Py_False and Py_True are the only two bools in existence.
|
|
11 Don't forget to apply Py_INCREF() when returning either!!! */
|
|
12
|
|
13 /* Don't use these directly */
|
|
14 PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
|
|
15
|
|
16 /* Use these macros */
|
|
17 #define Py_False ((PyObject *) &_Py_FalseStruct)
|
|
18 #define Py_True ((PyObject *) &_Py_TrueStruct)
|
|
19
|
|
20 /* Macros for returning Py_True or Py_False, respectively */
|
|
21 #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
|
|
22 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
|
|
23
|
|
24 /* Function to return a bool from a C long */
|
|
25 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
|
|
26
|
|
27 #endif /* !Py_BOOLOBJECT_H */
|