Skip to content

Commit 57c7a0b

Browse files
authored
Doc: int -> int or Py_ssize_t (GH-18663)
1 parent 541e0ff commit 57c7a0b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Doc/c-api/arg.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ which disallows mutable objects such as :class:`bytearray`.
105105
Like ``s*``, but the Python object may also be ``None``, in which case the
106106
``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
107107

108-
``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, int]
108+
``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
109109
Like ``s#``, but the Python object may also be ``None``, in which case the C
110110
pointer is set to ``NULL``.
111111

@@ -124,7 +124,7 @@ which disallows mutable objects such as :class:`bytearray`.
124124
bytes-like objects. **This is the recommended way to accept
125125
binary data.**
126126

127-
``y#`` (read-only :term:`bytes-like object`) [const char \*, int]
127+
``y#`` (read-only :term:`bytes-like object`) [const char \*, int or :c:type:`Py_ssize_t`]
128128
This variant on ``s#`` doesn't accept Unicode objects, only bytes-like
129129
objects.
130130

@@ -155,7 +155,7 @@ which disallows mutable objects such as :class:`bytearray`.
155155
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
156156
:c:func:`PyUnicode_AsWideCharString`.
157157

158-
``u#`` (:class:`str`) [const Py_UNICODE \*, int]
158+
``u#`` (:class:`str`) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
159159
This variant on ``u`` stores into two C variables, the first one a pointer to a
160160
Unicode data buffer, the second one its length. This variant allows
161161
null code points.
@@ -172,7 +172,7 @@ which disallows mutable objects such as :class:`bytearray`.
172172
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
173173
:c:func:`PyUnicode_AsWideCharString`.
174174

175-
``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int]
175+
``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
176176
Like ``u#``, but the Python object may also be ``None``, in which case the
177177
:c:type:`Py_UNICODE` pointer is set to ``NULL``.
178178

@@ -213,7 +213,7 @@ which disallows mutable objects such as :class:`bytearray`.
213213
recoding them. Instead, the implementation assumes that the byte string object uses
214214
the encoding passed in as parameter.
215215

216-
``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
216+
``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
217217
This variant on ``s#`` is used for encoding Unicode into a character buffer.
218218
Unlike the ``es`` format, this variant allows input data which contains NUL
219219
characters.
@@ -244,7 +244,7 @@ which disallows mutable objects such as :class:`bytearray`.
244244
In both cases, *\*buffer_length* is set to the length of the encoded data
245245
without the trailing NUL byte.
246246

247-
``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
247+
``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
248248
Same as ``es#`` except that byte string objects are passed through without recoding
249249
them. Instead, the implementation assumes that the byte string object uses the
250250
encoding passed in as parameter.
@@ -549,7 +549,7 @@ Building values
549549
Convert a null-terminated C string to a Python :class:`str` object using ``'utf-8'``
550550
encoding. If the C string pointer is ``NULL``, ``None`` is used.
551551
552-
``s#`` (:class:`str` or ``None``) [const char \*, int]
552+
``s#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
553553
Convert a C string and its length to a Python :class:`str` object using ``'utf-8'``
554554
encoding. If the C string pointer is ``NULL``, the length is ignored and
555555
``None`` is returned.
@@ -558,30 +558,30 @@ Building values
558558
This converts a C string to a Python :class:`bytes` object. If the C
559559
string pointer is ``NULL``, ``None`` is returned.
560560
561-
``y#`` (:class:`bytes`) [const char \*, int]
561+
``y#`` (:class:`bytes`) [const char \*, int or :c:type:`Py_ssize_t`]
562562
This converts a C string and its lengths to a Python object. If the C
563563
string pointer is ``NULL``, ``None`` is returned.
564564
565565
``z`` (:class:`str` or ``None``) [const char \*]
566566
Same as ``s``.
567567
568-
``z#`` (:class:`str` or ``None``) [const char \*, int]
568+
``z#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
569569
Same as ``s#``.
570570
571571
``u`` (:class:`str`) [const wchar_t \*]
572572
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
573573
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
574574
``None`` is returned.
575575
576-
``u#`` (:class:`str`) [const wchar_t \*, int]
576+
``u#`` (:class:`str`) [const wchar_t \*, int or :c:type:`Py_ssize_t`]
577577
Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python
578578
Unicode object. If the Unicode buffer pointer is ``NULL``, the length is ignored
579579
and ``None`` is returned.
580580
581581
``U`` (:class:`str` or ``None``) [const char \*]
582582
Same as ``s``.
583583
584-
``U#`` (:class:`str` or ``None``) [const char \*, int]
584+
``U#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
585585
Same as ``s#``.
586586
587587
``i`` (:class:`int`) [int]

0 commit comments

Comments
 (0)