diff options
author | Christian Heimes <christian@cheimes.de> | 2007-11-30 22:29:24 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-11-30 22:29:24 (GMT) |
commit | 05a2fc2274ef8253474b664ab7067e5eab23a93e (patch) | |
tree | 70df5d3bcf82c9767a76fc2d151e0a4424284cdb | |
parent | 4e30a845b4d2496dab25f0016cb597072c7355b1 (diff) | |
download | cpython-05a2fc2274ef8253474b664ab7067e5eab23a93e.zip cpython-05a2fc2274ef8253474b664ab7067e5eab23a93e.tar.gz cpython-05a2fc2274ef8253474b664ab7067e5eab23a93e.tar.bz2 |
Cleanups and documentation updates related to the removal of unbound methods.
-rw-r--r-- | Doc/c-api/concrete.rst | 29 | ||||
-rw-r--r-- | Doc/library/types.rst | 1 | ||||
-rw-r--r-- | Include/classobject.h | 1 |
3 files changed, 8 insertions, 23 deletions
diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst index 50ab005..b6cc60e 100644 --- a/Doc/c-api/concrete.rst +++ b/Doc/c-api/concrete.rst @@ -2577,7 +2577,9 @@ Method Objects .. 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 @@ -2594,25 +2596,11 @@ There are some useful functions that are useful for working with method objects. 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 - 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. - - .. 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. + Return a new method object, with *func* being any callable object and *self* + the instance the method should be bound. *func* is is the function that will + be called when the method is called. *self* must not be *NULL*. .. 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) - Return the instance associated with the method *meth* if it is bound, otherwise - return *NULL*. + Return the instance associated with the method *meth*. .. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth) diff --git a/Doc/library/types.rst b/Doc/library/types.rst index a3d30fa..ddb7e7d 100644 --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -58,7 +58,6 @@ The module defines the following names: .. data:: MethodType - UnboundMethdType The type of methods of user-defined class instances. diff --git a/Include/classobject.h b/Include/classobject.h index e6ca421..699546e 100644 --- a/Include/classobject.h +++ b/Include/classobject.h @@ -23,7 +23,6 @@ PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); -PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ |