• Guido van Rossum's avatar
    Address SF patch #480716 as well as related issues. · 5b443c62
    Guido van Rossum yazdı
    SF patch #480716 by Greg Chapman fixes the problem that super's
    __get__ method always returns an instance of super, even when the
    instance whose __get__ method is called is an instance of a subclass
    of super.
    
    Other issues fixed:
    
    - super(C, C()).__class__ would return the __class__ attribute of C()
      rather than the __class__ attribute of the super object.  This is
      confusing.  To fix this, I decided to change the semantics of super
      so that it only applies to code attributes, not to data attributes.
      After all, overriding data attributes is not supported anyway.
    
    - While super(C, x) carefully checked that x is an instance of C,
      super(C).__get__(x) made no such check, allowing for a loophole.
      This is now fixed.
    5b443c62
typeobject.c 101 KB