diff options
| author | Jason Madden <jamadden@gmail.com> | 2020-02-06 09:02:56 -0600 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2020-02-06 09:02:56 -0600 |
| commit | 0b0e22727b52aa2e0f05884ce130524700163902 (patch) | |
| tree | 45a3aac378da646272b02f04d660d4f868d40219 /src/zope/interface/common/sequence.py | |
| parent | 0048a56bac299db7c78a9c8e52c5928e4ec06f38 (diff) | |
| download | zope-interface-0b0e22727b52aa2e0f05884ce130524700163902.tar.gz | |
Fix verification for methods of builtin types with pseudo-default arguments on Pypyissue118
On PyPy2, they are ignored (like on CPython), but on PyPy3 they can
actually be validated.
Fixes #118
Diffstat (limited to 'src/zope/interface/common/sequence.py')
| -rw-r--r-- | src/zope/interface/common/sequence.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/zope/interface/common/sequence.py b/src/zope/interface/common/sequence.py index 393918e..c36d615 100644 --- a/src/zope/interface/common/sequence.py +++ b/src/zope/interface/common/sequence.py @@ -19,6 +19,7 @@ as implementing any of these interfaces. __docformat__ = 'restructuredtext' from zope.interface import Interface +from zope.interface._compat import PYTHON2 as PY2 class IMinimalSequence(Interface): """Most basic sequence interface. @@ -79,13 +80,14 @@ class IReadSequence(IFiniteSequence): def __rmul__(n): """``x.__rmul__(n) <==> n * x``""" - def __getslice__(i, j): - """``x.__getslice__(i, j) <==> x[i:j]`` + if PY2: + def __getslice__(i, j): + """``x.__getslice__(i, j) <==> x[i:j]`` - Use of negative indices is not supported. + Use of negative indices is not supported. - Deprecated since Python 2.0 but still a part of `UserList`. - """ + Deprecated since Python 2.0 but still a part of `UserList`. + """ class IExtendedReadSequence(IReadSequence): """Full read interface for lists""" @@ -116,21 +118,23 @@ class IUniqueMemberWriteSequence(Interface): supports slice objects. """ - def __setslice__(i, j, other): - """``x.__setslice__(i, j, other) <==> x[i:j] = other`` + if PY2: + def __setslice__(i, j, other): + """``x.__setslice__(i, j, other) <==> x[i:j] = other`` - Use of negative indices is not supported. + Use of negative indices is not supported. - Deprecated since Python 2.0 but still a part of `UserList`. - """ + Deprecated since Python 2.0 but still a part of `UserList`. + """ - def __delslice__(i, j): - """``x.__delslice__(i, j) <==> del x[i:j]`` + def __delslice__(i, j): + """``x.__delslice__(i, j) <==> del x[i:j]`` - Use of negative indices is not supported. + Use of negative indices is not supported. + + Deprecated since Python 2.0 but still a part of `UserList`. + """ - Deprecated since Python 2.0 but still a part of `UserList`. - """ def __iadd__(y): """``x.__iadd__(y) <==> x += y``""" |
