Boost logo

Boost :

From: l.dunn_at_[hidden]
Date: 2001-03-17 01:41:25


Hi Dave,
I've located the point in the python 2.0 code where this occurs:

ceval.c, line 1816 (reformatted for clarity):

/* BEGIN CODE SAMPLE */

else
{

        /* Unbound methods must be called with an instance of the
        class (or a derived class) as first argument */
        if (na > 0 && (self = stack_pointer[-n]) != NULL
                && PyInstance_Check(self)
                && PyClass_IsSubclass((PyObject *)
                  ((PyInstanceObject*)self)->in_class), class))
                /* Handy-dandy */ ;
        else
        {
                PyErr_SetString(PyExc_TypeError,
                        "unbound method must be called with class
                         instance 1st argument");
                x = NULL;
                break;
        }
}

/* END CODE SAMPLE */

Lorien

--- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:

> Surely. It was my impression that Python 2.0 was supposed to fix
this
> problem, but it looks like I just assumed that it did because they
fixed the
> way isinstance and issubclass work. I'm surprised that the
approach wasn't
> extended a bit further :-(
>
> It would be a relatively easy thing to change in the Python
source, though
> I'm not sure what the impact would be. I'm not in the business of
> maintaining Python, either. Posting a suggestion to
comp.lang.python
> wouldn't hurt, if you want to do it.
>
> -Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk