mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Cleanups and documentation updates related to the removal of unbound methods.
This commit is contained in:
parent
4e30a845b4
commit
05a2fc2274
3 changed files with 8 additions and 23 deletions
|
|
@ -2577,7 +2577,9 @@ Method Objects
|
||||||
|
|
||||||
.. index:: object: method
|
.. index:: object: method
|
||||||
|
|
||||||
There are some useful functions that are useful for working with method objects.
|
Methods are bound function objects. Methods are always bound to an instance of
|
||||||
|
an user-defined class. Unbound methods (methods bound to a class object) are
|
||||||
|
no longer available.
|
||||||
|
|
||||||
|
|
||||||
.. cvar:: PyTypeObject PyMethod_Type
|
.. cvar:: PyTypeObject PyMethod_Type
|
||||||
|
|
@ -2594,25 +2596,11 @@ There are some useful functions that are useful for working with method objects.
|
||||||
parameter must not be *NULL*.
|
parameter must not be *NULL*.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self, PyObject *class)
|
.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self)
|
||||||
|
|
||||||
Return a new method object, with *func* being any callable object; this is the
|
Return a new method object, with *func* being any callable object and *self*
|
||||||
function that will be called when the method is called. If this method should
|
the instance the method should be bound. *func* is is the function that will
|
||||||
be bound to an instance, *self* should be the instance and *class* should be the
|
be called when the method is called. *self* must not be *NULL*.
|
||||||
class of *self*, otherwise *self* should be *NULL* and *class* should be the
|
|
||||||
class which provides the unbound method.
|
|
||||||
|
|
||||||
.. XXX no unbound methods anymore...
|
|
||||||
|
|
||||||
.. 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)
|
.. cfunction:: PyObject* PyMethod_Function(PyObject *meth)
|
||||||
|
|
@ -2627,8 +2615,7 @@ There are some useful functions that are useful for working with method objects.
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyMethod_Self(PyObject *meth)
|
.. cfunction:: PyObject* PyMethod_Self(PyObject *meth)
|
||||||
|
|
||||||
Return the instance associated with the method *meth* if it is bound, otherwise
|
Return the instance associated with the method *meth*.
|
||||||
return *NULL*.
|
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth)
|
.. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth)
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ The module defines the following names:
|
||||||
|
|
||||||
|
|
||||||
.. data:: MethodType
|
.. data:: MethodType
|
||||||
UnboundMethdType
|
|
||||||
|
|
||||||
The type of methods of user-defined class instances.
|
The type of methods of user-defined class instances.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
|
|
||||||
|
|
||||||
/* Macros for direct access to these values. Type checks are *not*
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
done, so use with care. */
|
done, so use with care. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue