bool.pxd 1.3 KB

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