Skip to content

Commit 8d0ed59

Browse files
author
neal.norwitz
committed
Issue 2332: add new attribute names for instance method objects
git-svn-id: http://svn.python.org/projects/python/trunk@61492 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 41dc666 commit 8d0ed59

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2?
1212
Core and builtins
1313
-----------------
1414

15+
- Issue 2332: add new attribute names for instance method objects.
16+
The two changes are: im_self -> __self__ and im_func -> __func__
17+
1518
- Issue 2379: Raise a Py3K warning for __getitem__ or __getslice__ on
1619
exception instances.
1720

Objects/classobject.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,8 +2242,12 @@ static PyMemberDef instancemethod_memberlist[] = {
22422242
"the class associated with a method"},
22432243
{"im_func", T_OBJECT, OFF(im_func), READONLY|RESTRICTED,
22442244
"the function (or other callable) implementing a method"},
2245+
{"__func__", T_OBJECT, OFF(im_func), READONLY|RESTRICTED,
2246+
"the function (or other callable) implementing a method"},
22452247
{"im_self", T_OBJECT, OFF(im_self), READONLY|RESTRICTED,
22462248
"the instance to which a method is bound; None for unbound methods"},
2249+
{"__self__", T_OBJECT, OFF(im_self), READONLY|RESTRICTED,
2250+
"the instance to which a method is bound; None for unbound methods"},
22472251
{NULL} /* Sentinel */
22482252
};
22492253

0 commit comments

Comments
 (0)