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

Skip to content

Commit 05a2fc2

Browse files
committed
Cleanups and documentation updates related to the removal of unbound methods.
1 parent 4e30a84 commit 05a2fc2

3 files changed

Lines changed: 8 additions & 23 deletions

File tree

Doc/c-api/concrete.rst

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,9 @@ Method Objects
25772577

25782578
.. index:: object: method
25792579

2580-
There are some useful functions that are useful for working with method objects.
2580+
Methods are bound function objects. Methods are always bound to an instance of
2581+
an user-defined class. Unbound methods (methods bound to a class object) are
2582+
no longer available.
25812583

25822584

25832585
.. cvar:: PyTypeObject PyMethod_Type
@@ -2594,25 +2596,11 @@ There are some useful functions that are useful for working with method objects.
25942596
parameter must not be *NULL*.
25952597

25962598

2597-
.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self, PyObject *class)
2599+
.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self)
25982600

2599-
Return a new method object, with *func* being any callable object; this is the
2600-
function that will be called when the method is called. If this method should
2601-
be bound to an instance, *self* should be the instance and *class* should be the
2602-
class of *self*, otherwise *self* should be *NULL* and *class* should be the
2603-
class which provides the unbound method.
2604-
2605-
.. XXX no unbound methods anymore...
2606-
2607-
.. cfunction:: PyObject* PyMethod_Class(PyObject *meth)
2608-
2609-
Return the class object from which the method *meth* was created; if this was
2610-
created from an instance, it will be the class of the instance.
2611-
2612-
2613-
.. cfunction:: PyObject* PyMethod_GET_CLASS(PyObject *meth)
2614-
2615-
Macro version of :cfunc:`PyMethod_Class` which avoids error checking.
2601+
Return a new method object, with *func* being any callable object and *self*
2602+
the instance the method should be bound. *func* is is the function that will
2603+
be called when the method is called. *self* must not be *NULL*.
26162604

26172605

26182606
.. cfunction:: PyObject* PyMethod_Function(PyObject *meth)
@@ -2627,8 +2615,7 @@ There are some useful functions that are useful for working with method objects.
26272615

26282616
.. cfunction:: PyObject* PyMethod_Self(PyObject *meth)
26292617

2630-
Return the instance associated with the method *meth* if it is bound, otherwise
2631-
return *NULL*.
2618+
Return the instance associated with the method *meth*.
26322619

26332620

26342621
.. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth)

Doc/library/types.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ The module defines the following names:
5858

5959

6060
.. data:: MethodType
61-
UnboundMethdType
6261

6362
The type of methods of user-defined class instances.
6463

Include/classobject.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
2323

2424
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
2525
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
26-
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
2726

2827
/* Macros for direct access to these values. Type checks are *not*
2928
done, so use with care. */

0 commit comments

Comments
 (0)