assigned to a class variable and then accessed via an instance, it
should not be rebound.
test_descr.py:methods(): test for the condition above.
d2 = D(2)
verify(d2.foo() == 2)
verify(d2.boo() == 2)
- verify(d2.goo() == 2)
+ verify(d2.goo() == 1)
def specials():
# Test operators like __hash__ for which a built-in default exists
static PyObject *
instancemethod_descr_get(PyObject *meth, PyObject *obj, PyObject *type)
{
+ if (PyMethod_GET_SELF(meth) != NULL) {
+ /* Don't rebind an already bound method */
+ Py_INCREF(meth);
+ return meth;
+ }
if (obj == Py_None)
obj = NULL;
return PyMethod_New(PyMethod_GET_FUNCTION(meth), obj, type);