On Thu, Sep 19, 2013 at 4:12 AM, Nick Coghlan <ncogh...@gmail.com> wrote:

> On 19 Sep 2013 20:00, "Paul Moore" <p.f.mo...@gmail.com> wrote:
> >
> > On 19 September 2013 10:32, Ronald Oussoren <ronaldousso...@mac.com>
> wrote:
> > > The first time a method is called the bridge looks for an Objective-C
> selector
> > > with the same name and adds that to the class dictionary. This works
> fine for normal
> > > method lookups, by overriding __getattribute__, but causes problems
> with super:
> > > super happily ignores __getattribute__ and peeks in the class __dict__
> which may
> > > not yet contain the name we're looking for and that can result in
> incorrect results
> > > (both incorrect AttributeErrors and totally incorrect results when the
> name is
> > > not yet present in the parent class' __dict__ but is in the
> grandparent's __dict__).
> >
> > As an alternative approach, could you use a custom dict subclass as
> > the class __dict__, and catch the peeking in the class __dict__ that
> > way? Or is this one of those places where only a real dict will do?
>
> Even Python 3 doesn't let you control the *runtime* type of the class
> dict, only the type used during evaluation of the class body.
>
> I've played with changing that - it makes for a rather special interpreter
> experience :)
>
Same here. :)  The PyDict_* API is not your friend for that.  It's why I
gave up on using a C OrderedDict for tp_dict (opting for a
__definition_order__ attribute on classes instead).

-eric
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to