summaryrefslogtreecommitdiff
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-05-29 04:58:52 +0000
committerRaymond Hettinger <python@rcn.com>2009-05-29 04:58:52 +0000
commit578a228ee265e9ce4d88c01f8d9fd57a237cfc3e (patch)
tree4e8e026d3e5c06f2048d2c872d42f2d666a93058 /Objects/funcobject.c
parent7937d939b1e41e869ebd6a41787c186482f5950f (diff)
downloadcpython-git-578a228ee265e9ce4d88c01f8d9fd57a237cfc3e.tar.gz
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 a2e87b733c..14484e5b3c 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -669,6 +669,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\
@@ -719,7 +724,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 */
@@ -819,6 +824,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\
@@ -866,7 +876,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 */