diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-11 19:56:40 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-11 19:56:40 (GMT) |
commit | a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b (patch) | |
tree | a39ae6545f6c82f842768ae2bfa4afcd931f5573 /Doc/c-api/concrete.rst | |
parent | fc5aa9d0bcf56d3bda0f033593ca4506b83515ee (diff) | |
download | cpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.zip cpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.tar.gz cpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.tar.bz2 |
Issue #1587: Added instancemethod wrapper for PyCFunctions. The Python C API
has gained a new type *PyInstanceMethod_Type* and the functions
*PyInstanceMethod_Check(o)*, *PyInstanceMethod_New(func)* and
*PyInstanceMethod_Function(im)*.
Diffstat (limited to 'Doc/c-api/concrete.rst')
-rw-r--r-- | Doc/c-api/concrete.rst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst index 5ff8969..b293ebf 100644 --- a/Doc/c-api/concrete.rst +++ b/Doc/c-api/concrete.rst @@ -2522,6 +2522,47 @@ There are a few functions specific to Python functions. Raises :exc:`SystemError` and returns ``-1`` on failure. +.. _instancemethod-objects: + +Instance Method Objects +----------------------- + +.. index:: object: instancemethod + +An instance method is a wrapper for a :cdata:`PyCFunction` and the new way +to bind a :cdata:`PyCFunction` to a class object. It replaces the former call +:cfunc:`PyMethod_New(func, NULL, class)`. + + +.. cvar:: PyTypeObject PyInstanceMethod_Type + + This instance of :ctype:`PyTypeObject` represents the Python instance + method type. It is not exposed to Python programs. + + +.. cfunction:: int PyInstanceMethod_Check(PyObject *o) + + Return true if *o* is an instance method object (has type + :cdata:`PyInstanceMethod_Type`). The parameter must not be *NULL*. + + +.. cfunction:: PyObject* PyInstanceMethod_New(PyObject *func) + + Return a new instance method object, with *func* being any callable object + *func* is is the function that will be called when the instance method is + called. + + +.. cfunction:: PyObject* PyInstanceMethod_Function(PyObject *im) + + Return the function object associated with the instance method *im*. + + +.. cfunction:: PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *im) + + Macro version of :cfunc:`PyInstanceMethod_Function` which avoids error checking. + + .. _method-objects: Method Objects |