summaryrefslogtreecommitdiff
path: root/tests/run/special_methods_T561.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/special_methods_T561.pyx')
-rw-r--r--tests/run/special_methods_T561.pyx57
1 files changed, 33 insertions, 24 deletions
diff --git a/tests/run/special_methods_T561.pyx b/tests/run/special_methods_T561.pyx
index d585f35d0..5995c3fdd 100644
--- a/tests/run/special_methods_T561.pyx
+++ b/tests/run/special_methods_T561.pyx
@@ -55,30 +55,6 @@ __doc__ = u"""
AttributeError: 'special_methods_T561.GetAttribute' object has no attribute '__getattr__'
>>> g11 = object.__getattribute__(GetAttribute(), '__getattribute__')
>>> g11('attr')
- GetAttribute getattribute 'attr'
- >>> # If you define either setattr or delattr, you get wrapper objects
- >>> # for both methods. (This behavior is unchanged by #561.)
- >>> sa_setattr = SetAttr().__setattr__
- >>> sa_setattr('foo', 'bar')
- SetAttr setattr 'foo' 'bar'
- >>> sa_delattr = SetAttr().__delattr__
- >>> sa_delattr('foo')
- Traceback (most recent call last):
- ...
- AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo'
- >>> da_setattr = DelAttr().__setattr__
- >>> da_setattr('foo', 'bar')
- Traceback (most recent call last):
- ...
- AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo'
- >>> da_delattr = DelAttr().__delattr__
- >>> da_delattr('foo')
- DelAttr delattr 'foo'
- >>> sda_setattr = SetDelAttr().__setattr__
- >>> sda_setattr('foo', 'bar')
- SetDelAttr setattr 'foo' 'bar'
- >>> sda_delattr = SetDelAttr().__delattr__
- >>> sda_delattr('foo')
SetDelAttr delattr 'foo'
>>> # If you define either set or delete, you get wrapper objects
>>> # for both methods. (This behavior is unchanged by #561.)
@@ -119,6 +95,39 @@ if sys.version_info >= (2,5):
VS __index__ 0
"""
+cdef extern from *:
+ # type specs require a bug fix in Py3.8+ for some of these tests.
+ const int CYTHON_USE_TYPE_SPECS
+
+if not CYTHON_USE_TYPE_SPECS or sys.version_info >= (3,8):
+ __doc__ += u"""
+ GetAttribute getattribute 'attr'
+ >>> # If you define either setattr or delattr, you get wrapper objects
+ >>> # for both methods. (This behavior is unchanged by #561.)
+ >>> sa_setattr = SetAttr().__setattr__
+ >>> sa_setattr('foo', 'bar')
+ SetAttr setattr 'foo' 'bar'
+ >>> sa_delattr = SetAttr().__delattr__
+ >>> sa_delattr('foo')
+ Traceback (most recent call last):
+ ...
+ AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo'
+ >>> da_setattr = DelAttr().__setattr__
+ >>> da_setattr('foo', 'bar')
+ Traceback (most recent call last):
+ ...
+ AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo'
+ >>> da_delattr = DelAttr().__delattr__
+ >>> da_delattr('foo')
+ DelAttr delattr 'foo'
+ >>> sda_setattr = SetDelAttr().__setattr__
+ >>> sda_setattr('foo', 'bar')
+ SetDelAttr setattr 'foo' 'bar'
+ >>> sda_delattr = SetDelAttr().__delattr__
+ >>> sda_delattr('foo')
+"""
+
+
cdef class VerySpecial:
"""
>>> vs0 = VerySpecial(0)