Hi,
Peter Todd wrote:
>>> From what I can see I'd be
>>> updating generate_getattro_function() to do a scope.lookup_here() on
>>> '__getattribute__' first, if that succeeds, output code to call it,
>>> otherwise go on to the existing code.
Please see the code in Python's typeobject.c, functions "slot_tp_getattr_hook"
and "slot_tp_getattro" (essentially a fast path), and the comment above them.
The code Cython generates must behave like these two.
> On Wed, Apr 30, 2008 at 07:12:42PM -0700, Robert Bradshaw wrote:
>> Sounds like a good plan. Is __getattribute__ inherited?
Python is already doing a couple of things here for us. There is some code in
"inherit_slots" (typeobject.c) that inherits the slots, but only if both get*
functions are set to NULL, or set* functions respectively:
if (type->tp_getattr == NULL && type->tp_getattro == NULL) {
type->tp_getattr = base->tp_getattr;
type->tp_getattro = base->tp_getattro;
}
if (type->tp_setattr == NULL && type->tp_setattro == NULL) {
type->tp_setattr = base->tp_setattr;
type->tp_setattro = base->tp_setattro;
}
Again, Cython must behave alike here.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev