mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Issue 5982: Classmethod and staticmethod expose wrapped function with __func__.
This commit is contained in:
parent
ebe99ab344
commit
2bcde144ae
3 changed files with 28 additions and 3 deletions
|
@ -775,6 +775,11 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyMemberDef cm_memberlist[] = {
|
||||
{"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(classmethod_doc,
|
||||
"classmethod(function) -> method\n\
|
||||
\n\
|
||||
|
@ -825,7 +830,7 @@ PyTypeObject PyClassMethod_Type = {
|
|||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
cm_memberlist, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
|
@ -925,6 +930,11 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyMemberDef sm_memberlist[] = {
|
||||
{"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(staticmethod_doc,
|
||||
"staticmethod(function) -> method\n\
|
||||
\n\
|
||||
|
@ -972,7 +982,7 @@ PyTypeObject PyStaticMethod_Type = {
|
|||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
sm_memberlist, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue