]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 10 Jul 2024 11:03:22 +0000 (13:03 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 11:03:22 +0000 (11:03 +0000)
gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568)
(cherry picked from commit 84a5597b08b7d53aced2fbd0048271ce762807a8)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Doc/c-api/slice.rst

index 9e880c6b7f25adbef823a5d8372a18750d6c28ce..819929a0e60ca75a8d076931c1718b9918585498 100644 (file)
@@ -23,7 +23,9 @@ Slice Objects
    Return a new slice object with the given values.  The *start*, *stop*, and
    *step* parameters are used as the values of the slice object attributes of
    the same names.  Any of the values may be ``NULL``, in which case the
-   ``None`` will be used for the corresponding attribute.  Return ``NULL`` if
+   ``None`` will be used for the corresponding attribute.
+
+   Return ``NULL`` with an exception set if
    the new object could not be allocated.
 
 
@@ -52,7 +54,7 @@ Slice Objects
    of bounds indices are clipped in a manner consistent with the handling of
    normal slices.
 
-   Returns ``0`` on success and ``-1`` on error with exception set.
+   Return ``0`` on success and ``-1`` on error with an exception set.
 
    .. note::
       This function is considered not safe for resizable sequences.
@@ -95,7 +97,7 @@ Slice Objects
    ``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step
    values less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``.
 
-   Return ``-1`` on error, ``0`` on success.
+   Return ``-1`` with an exception set on error, ``0`` on success.
 
    .. versionadded:: 3.6.1