method.pxd 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from .object cimport PyObject
  2. cdef extern from "Python.h":
  3. ############################################################################
  4. # 7.5.4 Method Objects
  5. ############################################################################
  6. # There are some useful functions that are useful for working with method objects.
  7. # PyTypeObject PyMethod_Type
  8. # This instance of PyTypeObject represents the Python method type. This is exposed to Python programs as types.MethodType.
  9. bint PyMethod_Check(object o)
  10. # Return true if o is a method object (has type
  11. # PyMethod_Type). The parameter must not be NULL.
  12. object PyMethod_New(object func, object self, object cls)
  13. # Return value: New reference.
  14. # Return a new method object, with func being any callable object;
  15. # this is the function that will be called when the method is
  16. # called. If this method should be bound to an instance, self
  17. # should be the instance and class should be the class of self,
  18. # otherwise self should be NULL and class should be the class
  19. # which provides the unbound method..
  20. PyObject* PyMethod_Class(object meth) except NULL
  21. # Return value: Borrowed reference.
  22. # Return the class object from which the method meth was created;
  23. # if this was created from an instance, it will be the class of
  24. # the instance.
  25. PyObject* PyMethod_GET_CLASS(object meth)
  26. # Return value: Borrowed reference.
  27. # Macro version of PyMethod_Class() which avoids error checking.
  28. PyObject* PyMethod_Function(object meth) except NULL
  29. # Return value: Borrowed reference.
  30. # Return the function object associated with the method meth.
  31. PyObject* PyMethod_GET_FUNCTION(object meth)
  32. # Return value: Borrowed reference.
  33. # Macro version of PyMethod_Function() which avoids error checking.
  34. PyObject* PyMethod_Self(object meth) except? NULL
  35. # Return value: Borrowed reference.
  36. # Return the instance associated with the method meth if it is bound, otherwise return NULL.
  37. PyObject* PyMethod_GET_SELF(object meth)
  38. # Return value: Borrowed reference.
  39. # Macro version of PyMethod_Self() which avoids error checking.