]> granicus.if.org Git - python/commit
Address SF patch #480716 as well as related issues.
authorGuido van Rossum <guido@python.org>
Mon, 3 Dec 2001 15:38:28 +0000 (15:38 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 3 Dec 2001 15:38:28 +0000 (15:38 +0000)
commit5b443c6282e8ffd6873005b62c50e56fa149e277
treead424630007b688380534e7d2181a59aba44c8f6
parent22f9c6ddb81bf486748671c38b1cea53b88f1f82
Address SF patch #480716 as well as related issues.

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.
Lib/test/test_descr.py
Objects/typeobject.c