From a4541a30fcd101c6c6ed83a55d13c505f97378d8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 16 Apr 2003 20:02:22 +0000 Subject: [PATCH] - super() no longer ignores data descriptors, except __class__. See the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html --- Lib/test/test_descr.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 4a9cc50a20d..972e22401ae 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1989,7 +1989,7 @@ def supers(): class F(E): def meth(self, a): - s = self.__super + s = self.__super # == mysuper(F, self) return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a) F._F__super = mysuper(F) @@ -2025,6 +2025,21 @@ def supers(): else: raise TestFailed, "shouldn't allow super(D).__get__(C())" + # Make sure data descriptors can be overridden and accessed via super + # (new feature in Python 2.3) + + class DDbase(object): + def getx(self): return 42 + x = property(getx) + + class DDsub(DDbase): + def getx(self): return "hello" + x = property(getx) + + dd = DDsub() + vereq(dd.x, "hello") + vereq(super(DDsub, dd).x, 42) + def inherits(): if verbose: print "Testing inheritance from basic types..."