summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/method.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-19 22:08:21 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-19 22:08:21 (GMT)
commitf6842722df69a40e841c045d42a538bb5d6bbbf6 (patch)
tree2b8bb1b6bb5908ed66ed72f7c84de0a34ddc7542 /Doc/c-api/method.rst
parent8b506e7a2d4e8cb6ffd6b7f2845e45aa92daa4d4 (diff)
downloadcpython-f6842722df69a40e841c045d42a538bb5d6bbbf6.zip
cpython-f6842722df69a40e841c045d42a538bb5d6bbbf6.tar.gz
cpython-f6842722df69a40e841c045d42a538bb5d6bbbf6.tar.bz2
Split the monstrous C API manual files in smaller parts.
Diffstat (limited to 'Doc/c-api/method.rst')
-rw-r--r--Doc/c-api/method.rst65
1 files changed, 65 insertions, 0 deletions
diff --git a/Doc/c-api/method.rst b/Doc/c-api/method.rst
new file mode 100644
index 0000000..f20f14c
--- /dev/null
+++ b/Doc/c-api/method.rst
@@ -0,0 +1,65 @@
+.. highlightlang:: c
+
+.. _method-objects:
+
+Method Objects
+--------------
+
+.. index:: object: method
+
+There are some useful functions that are useful for working with method objects.
+
+
+.. cvar:: PyTypeObject PyMethod_Type
+
+ .. index:: single: MethodType (in module types)
+
+ This instance of :ctype:`PyTypeObject` represents the Python method type. This
+ is exposed to Python programs as ``types.MethodType``.
+
+
+.. cfunction:: int PyMethod_Check(PyObject *o)
+
+ Return true if *o* is a method object (has type :cdata:`PyMethod_Type`). The
+ parameter must not be *NULL*.
+
+
+.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self, PyObject *class)
+
+ Return a new method object, with *func* being any callable object; this is the
+ function that will be called when the method is called. If this method should
+ be bound to an instance, *self* should be the instance and *class* should be the
+ class of *self*, otherwise *self* should be *NULL* and *class* should be the
+ class which provides the unbound method..
+
+
+.. cfunction:: PyObject* PyMethod_Class(PyObject *meth)
+
+ Return the class object from which the method *meth* was created; if this was
+ created from an instance, it will be the class of the instance.
+
+
+.. cfunction:: PyObject* PyMethod_GET_CLASS(PyObject *meth)
+
+ Macro version of :cfunc:`PyMethod_Class` which avoids error checking.
+
+
+.. cfunction:: PyObject* PyMethod_Function(PyObject *meth)
+
+ Return the function object associated with the method *meth*.
+
+
+.. cfunction:: PyObject* PyMethod_GET_FUNCTION(PyObject *meth)
+
+ Macro version of :cfunc:`PyMethod_Function` which avoids error checking.
+
+
+.. cfunction:: PyObject* PyMethod_Self(PyObject *meth)
+
+ Return the instance associated with the method *meth* if it is bound, otherwise
+ return *NULL*.
+
+
+.. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth)
+
+ Macro version of :cfunc:`PyMethod_Self` which avoids error checking.