1
2cdef extern from "Python.h":
3
4    ############################################################################
5    # 7.2.2 Boolean Objects
6    ############################################################################
7
8    ctypedef class __builtin__.bool [object PyBoolObject]:
9        pass
10
11    # Booleans in Python are implemented as a subclass of
12    # integers. There are only two booleans, Py_False and Py_True. As
13    # such, the normal creation and deletion functions don't apply to
14    # booleans. The following macros are available, however.
15
16    bint PyBool_Check(object o)
17    # Return true if o is of type PyBool_Type.
18
19    #PyObject* Py_False
20    # The Python False object. This object has no methods. It needs to
21    # be treated just like any other object with respect to reference
22    # counts.
23
24    #PyObject* Py_True
25    # The Python True object. This object has no methods. It needs to
26    # be treated just like any other object with respect to reference
27    # counts.
28
29    # Py_RETURN_FALSE
30    # Return Py_False from a function, properly incrementing its reference count.
31
32    # Py_RETURN_TRUE
33    # Return Py_True from a function, properly incrementing its reference count.
34
35    object PyBool_FromLong(long v)
36    # Return value: New reference.
37    # Return a new reference to Py_True or Py_False depending on the truth value of v.
38
39