summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-03-18 04:46:00 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2008-03-18 04:46:00 +0000
commitb1d3d96374294904a13717403c80035718331092 (patch)
treefb348c08b9d4460e7b254754fffe91eb13ba8417
parent3781aef8f8f992f78b31c7029004fa7b1ada7304 (diff)
downloadcpython-git-b1d3d96374294904a13717403c80035718331092.tar.gz
Issue 2332: add new attribute names for instance method objects
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/classobject.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 2975c1530b..5382c84a78 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2?
Core and builtins
-----------------
+- Issue 2332: add new attribute names for instance method objects.
+ The two changes are: im_self -> __self__ and im_func -> __func__
+
- Issue 2379: Raise a Py3K warning for __getitem__ or __getslice__ on
exception instances.
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 6c77153959..caf6b3e7b0 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -2242,8 +2242,12 @@ static PyMemberDef instancemethod_memberlist[] = {
"the class associated with a method"},
{"im_func", T_OBJECT, OFF(im_func), READONLY|RESTRICTED,
"the function (or other callable) implementing a method"},
+ {"__func__", T_OBJECT, OFF(im_func), READONLY|RESTRICTED,
+ "the function (or other callable) implementing a method"},
{"im_self", T_OBJECT, OFF(im_self), READONLY|RESTRICTED,
"the instance to which a method is bound; None for unbound methods"},
+ {"__self__", T_OBJECT, OFF(im_self), READONLY|RESTRICTED,
+ "the instance to which a method is bound; None for unbound methods"},
{NULL} /* Sentinel */
};