Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8d7a5d

Browse files
committed
Document the PyMethod_* type object, functions, and macros.
1 parent 0511b76 commit f8d7a5d

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Doc/api/api.tex

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4089,6 +4089,64 @@ \subsection{Instance Objects \label{instanceObjects}}
40894089
\end{cfuncdesc}
40904090

40914091

4092+
\subsection{Method Objects \label{method-objects}}
4093+
4094+
\obindex{method}
4095+
There are some useful functions that are useful for working with
4096+
method objects.
4097+
4098+
\begin{cvardesc}{PyTypeObject}{PyMethod_Type}
4099+
This instance of \ctype{PyTypeObject} represents the Python method
4100+
type. This is exposed to Python programs as \code{types.MethodType}.
4101+
\withsubitem{(in module types)}{\ttindex{MethodType}}
4102+
\end{cvardesc}
4103+
4104+
\begin{cfuncdesc}{int}{PyMethod_Check}{PyObject *o}
4105+
Return true if \var{o} is a method object (has type
4106+
\cdata{PyMethod_Type}). The parameter must not be \NULL.
4107+
\end{cfuncdesc}
4108+
4109+
\begin{cfuncdesc}{PyObject*}{PyMethod_New}{PyObject *func.
4110+
PyObject *self, PyObject *class}
4111+
Return a new method object, with \var{func} being any callable
4112+
object; this is the function that will be called when the method is
4113+
called. If this method should be bound to an instance, \var{self}
4114+
should be the instance and \var{class} should be the class of
4115+
\var{self}, otherwise \var{self} should be \NULL{} and \var{class}
4116+
should be the class which provides the unbound method..
4117+
\end{cfuncdesc}
4118+
4119+
\begin{cfuncdesc}{PyObject*}{PyMethod_Class}{PyObject *meth}
4120+
Return the class object from which the method \var{meth} was
4121+
created; if this was created from an instance, it will be the class
4122+
of the instance.
4123+
\end{cfuncdesc}
4124+
4125+
\begin{cfuncdesc}{PyObject*}{PyMethod_GET_CLASS}{PyObject *meth}
4126+
Macro version of \cfunction{PyMethod_Class()} which avoids error
4127+
checking.
4128+
\end{cfuncdesc}
4129+
4130+
\begin{cfuncdesc}{PyObject*}{PyMethod_Function}{PyObject *meth}
4131+
Return the function object associated with the method \var{meth}.
4132+
\end{cfuncdesc}
4133+
4134+
\begin{cfuncdesc}{PyObject*}{PyMethod_GET_FUNCTION}{PyObject *meth}
4135+
Macro version of \cfunction{PyMethod_Function()} which avoids error
4136+
checking.
4137+
\end{cfuncdesc}
4138+
4139+
\begin{cfuncdesc}{PyObject*}{PyMethod_Self}{PyObject *meth}
4140+
Return the instance associated with the method \var{meth} if it is
4141+
bound, otherwise return \NULL.
4142+
\end{cfuncdesc}
4143+
4144+
\begin{cfuncdesc}{PyObject*}{PyMethod_GET_SELF}{PyObject *meth}
4145+
Macro version of \cfunction{PyMethod_Self()} which avoids error
4146+
checking.
4147+
\end{cfuncdesc}
4148+
4149+
40924150
\subsection{Module Objects \label{moduleObjects}}
40934151

40944152
\obindex{module}

0 commit comments

Comments
 (0)