aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz <cfbolz@gmx.de>2016-03-05 13:37:25 +0100
committerCarl Friedrich Bolz <cfbolz@gmx.de>2016-03-05 13:37:25 +0100
commitf5a27837d71f0bf18271070ffccef598f5d41689 (patch)
treed951986f1f86acc0fb6e7a3e85c27558bdec3cad /pypy/module
parentadd a jit driver (unfortunately I can't use autoreds because of the green field (diff)
downloadpypy-f5a27837d71f0bf18271070ffccef598f5d41689.tar.gz
pypy-f5a27837d71f0bf18271070ffccef598f5d41689.tar.bz2
pypy-f5a27837d71f0bf18271070ffccef598f5d41689.zip
implement super.__thisclass__
Diffstat (limited to 'pypy/module')
-rw-r--r--pypy/module/__builtin__/descriptor.py1
-rw-r--r--pypy/module/__builtin__/test/test_descriptor.py8
2 files changed, 8 insertions, 1 deletions
diff --git a/pypy/module/__builtin__/descriptor.py b/pypy/module/__builtin__/descriptor.py
index 6aca0ff915..622da1f67c 100644
--- a/pypy/module/__builtin__/descriptor.py
+++ b/pypy/module/__builtin__/descriptor.py
@@ -79,6 +79,7 @@ def descr_new_super(space, w_subtype, w_starttype, w_obj_or_type=None):
W_Super.typedef = TypeDef(
'super',
__new__ = interp2app(descr_new_super),
+ __thisclass__ = interp_attrproperty_w("w_starttype", W_Super),
__getattribute__ = interp2app(W_Super.getattribute),
__get__ = interp2app(W_Super.get),
__doc__ = """super(type) -> unbound super object
diff --git a/pypy/module/__builtin__/test/test_descriptor.py b/pypy/module/__builtin__/test/test_descriptor.py
index 4066f13be2..6c26cded4f 100644
--- a/pypy/module/__builtin__/test/test_descriptor.py
+++ b/pypy/module/__builtin__/test/test_descriptor.py
@@ -214,7 +214,7 @@ class AppTestBuiltinApp:
c = C()
assert C.goo(1) == (C, 1)
assert c.goo(1) == (C, 1)
-
+
assert c.foo(1) == (c, 1)
class D(C):
pass
@@ -238,6 +238,12 @@ class AppTestBuiltinApp:
meth = classmethod(1).__get__(1)
raises(TypeError, meth)
+ def test_super_thisclass(self):
+ class A(object):
+ pass
+
+ assert super(A, A()).__thisclass__ is A
+
def test_property_docstring(self):
assert property.__doc__.startswith('property')