summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/slice.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-25 11:27:44 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-25 11:27:44 (GMT)
commit6e08baf12da60950561d50273799df93d120c127 (patch)
tree47c83df77e52659776a270fe29509c21b9174af5 /Doc/c-api/slice.rst
parenta8df8471d254086548325ffc451cdb73111bce83 (diff)
parent512c57cb72e108d0f68ceecbc88dfe3b2eb56371 (diff)
downloadcpython-6e08baf12da60950561d50273799df93d120c127.zip
cpython-6e08baf12da60950561d50273799df93d120c127.tar.gz
cpython-6e08baf12da60950561d50273799df93d120c127.tar.bz2
Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher. Added functions PySlice_Unpack() and PySlice_AdjustIndices().
Diffstat (limited to 'Doc/c-api/slice.rst')
-rw-r--r--Doc/c-api/slice.rst37
1 files changed, 37 insertions, 0 deletions
diff --git a/Doc/c-api/slice.rst b/Doc/c-api/slice.rst
index a825164..5606ae4 100644
--- a/Doc/c-api/slice.rst
+++ b/Doc/c-api/slice.rst
@@ -56,3 +56,40 @@ Slice Objects
.. versionchanged:: 3.2
The parameter type for the *slice* parameter was ``PySliceObject*``
before.
+
+ .. versionchanged:: 3.6.1
+ If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400``
+ and ``0x03060000`` (not including) or ``0x03060100`` or higher
+ :c:func:`!PySlice_GetIndicesEx` is implemented as a macro using
+ :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`.
+ Arguments *start*, *stop* and *step* are evaluated more than once.
+
+ .. deprecated:: 3.6.1
+ If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or
+ between ``0x03060000`` and ``0x03060100`` (not including)
+ :c:func:`!PySlice_GetIndicesEx` is a deprecated function.
+
+
+.. c:function:: int PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
+
+ Extract the start, stop and step data members from a slice object as
+ C integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to
+ ``PY_SSIZE_T_MAX``, silently boost the start and stop values less than
+ ``-PY_SSIZE_T_MAX-1`` to ``-PY_SSIZE_T_MAX-1``, and silently boost the step
+ values less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``.
+
+ Return ``-1`` on error, ``0`` on success.
+
+ .. versionadded:: 3.6.1
+
+
+.. c:function:: Py_ssize_t PySlice_AdjustIndices(Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step)
+
+ Adjust start/end slice indices assuming a sequence of the specified length.
+ Out of bounds indices are clipped in a manner consistent with the handling
+ of normal slices.
+
+ Return the length of the slice. Always successful. Doesn't call Python
+ code.
+
+ .. versionadded:: 3.6.1