Skip to content

Commit 731ae1f

Browse files
Document the step precondition of PySlice_AdjustIndices()
Also remove trailing whitespace added by a suggestion.
1 parent 1916314 commit 731ae1f

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎Doc/c-api/slice.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ Slice Objects
108108
Out of bounds indices are clipped in a manner consistent with the handling
109109
of normal slices.
110110
111+
*step* must not be zero and must not be less than ``-PY_SSIZE_T_MAX``,
112+
as guaranteed by :c:func:`PySlice_Unpack`.
113+
111114
Return the length of the slice. Always successful. Doesn't call Python
112115
code.
113116

‎Lib/test/test_capi/test_slice.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_getindices(self):
6464
self.assertEqual(getindices(slice(-3, -1), 10), (7, 9, 1))
6565
self.assertEqual(getindices(slice(-1, -3, -1), 10), (9, 7, -1))
6666
self.assertEqual(getindices(slice(None, None, -2), 0), (-1, -1, -2))
67-
self.assertEqual(getindices(slice(-3, -5, 1), 0), (-3, -5, 1))
67+
self.assertEqual(getindices(slice(-3, -5, 1), 0), (-3, -5, 1))
6868

6969
# It fails without setting an exception for out of bounds indices,
7070
# a zero step and non-integer indices.

0 commit comments

Comments
 (0)