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