[pypy-dev] Unbound method must be called with instance as first argument

Richard Emslie rxe at ukshells.co.uk
Sun Jul 11 14:57:29 CEST 2004


Hi Armin,

On Wed, 7 Jul 2004, Armin Rigo wrote:

> Hello Richard,
>
> On Tue, Jul 06, 2004 at 02:12:04PM +0100, Richard Emslie wrote:
>>>> The CPython implementation seems to be doing some hairy caching instead of
>>>> creating new method each __get__(), so it hard to tell if this is correct
>>>> behaviour.
>
> I believe we should closely follow CPython's behavior unless there is a reason
> not to.  The algorithm appears to look like:
>
> * already bound methods are never re-bound
>
> * unbound method objects can get bound but only to something more specific
> than before.
>

I got you checkins which do this - thanks.


I did notice that
def f(): pass
f.__get__()

crashes the pypy interpreter.

Sticking a try/except around performance_shortcut_call() in 
DescrOperation.call_args() fixes - but is not a solution.  I'm not sure 
why it goes wrong.

Cheers,
Richard



More information about the Pypy-dev mailing list