Skip to content

Commit aff021b

Browse files
committed
GH-95079: add missing documentation of error behavior
1 parent 6da988a commit aff021b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Doc/c-api/unicode.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ APIs:
345345
This is the recommended way to allocate a new Unicode object. Objects
346346
created using this function are not resizable.
347347
348+
On failure returns ``NULL`` and sets an exception.
349+
348350
.. versionadded:: 3.3
349351
350352
@@ -529,6 +531,10 @@ APIs:
529531
530532
Return the length of the Unicode object, in code points.
531533
534+
This function checks that *unicode* is a Unicode object, in contrast to
535+
:c:func:`PyUnicode_GET_LENGTH`, which performs no error checking. On error
536+
returns ``-1`` and sets an exception.
537+
532538
.. versionadded:: 3.3
533539
534540
@@ -572,6 +578,8 @@ APIs:
572578
not out of bounds, and that the object can be modified safely (i.e. that it
573579
its reference count is one).
574580
581+
Return ``0`` on success, ``-1`` on error with an exception set.
582+
575583
.. versionadded:: 3.3
576584
577585
@@ -581,6 +589,8 @@ APIs:
581589
Unicode object and the index is not out of bounds, in contrast to
582590
:c:func:`PyUnicode_READ_CHAR`, which performs no error checking.
583591
592+
Return character on success, ``-1`` on error with an exception set.
593+
584594
.. versionadded:: 3.3
585595
586596
@@ -589,6 +599,7 @@ APIs:
589599
590600
Return a substring of *str*, from character index *start* (included) to
591601
character index *end* (excluded). Negative indices are not supported.
602+
Returns ``NULL`` and sets an exception on error.
592603
593604
.. versionadded:: 3.3
594605

0 commit comments

Comments
 (0)