summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-05-29 04:52:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-05-29 04:52:27 (GMT)
commit2bcde144ae79c72de05196f7da4ed32396e398d6 (patch)
tree290c3629ef6f8d99dc59a0d0dadafdfb353efca6 /Objects/funcobject.c
parentebe99ab34444d911c6594d07de81966592cc9e85 (diff)
downloadcpython-2bcde144ae79c72de05196f7da4ed32396e398d6.zip
cpython-2bcde144ae79c72de05196f7da4ed32396e398d6.tar.gz
cpython-2bcde144ae79c72de05196f7da4ed32396e398d6.tar.bz2
Issue 5982: Classmethod and staticmethod expose wrapped function with __func__.
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 1bb2092..acd662c 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -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 */