Stefan Behnel wrote:

> Dag Sverre Seljebotn wrote:
> 
> > I.e. on vtable generation it seems to skip its immediate ancestor.
> 
> It still seems to be the right thing to do. Maybe Greg can enlighten us here.

There are a couple of things going on:

* When one type inherits from another, the struct for the
ancestor type is embedded as a member at the beginning of
the derived type, named __pyx_base.

* There is at most one vtable pointer in each instance,
and it lives in the struct for the most ancestral type
that has any C methods.

So the chain of __pyx_base references is drilling down
through the layers of the onion to the struct where the
vtable pointer is declared.

An alternative would be just to cast the object pointer
to the appropriate ancestor type, but at the time it
seemed cleaner to generate code that avoided casts if
possible.

-- 
Greg
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to