@@ -181,7 +181,7 @@ access internal read-only data of Unicode objects:
181
181
182
182
.. c:function:: Py_UCS4 PyUnicode_READ_CHAR(PyObject *unicode, Py_ssize_t index)
183
183
184
- Read a character from a Unicode object *o *, which must be in the "canonical"
184
+ Read a character from a Unicode object *unicode *, which must be in the "canonical"
185
185
representation. This is less efficient than :c:func: `PyUnicode_READ ` if you
186
186
do multiple consecutive reads.
187
187
@@ -406,7 +406,7 @@ APIs:
406
406
407
407
.. c:function:: PyObject* PyUnicode_FromStringAndSize(const char *str, Py_ssize_t size)
408
408
409
- Create a Unicode object from the char buffer *u *. The bytes will be
409
+ Create a Unicode object from the char buffer *str *. The bytes will be
410
410
interpreted as being UTF-8 encoded. The buffer is copied into the new
411
411
object. If the buffer is not ``NULL ``, the return value might be a shared
412
412
object, i.e. modification of the data is not allowed.
@@ -419,7 +419,7 @@ APIs:
419
419
.. c :function :: PyObject *PyUnicode_FromString (const char *str)
420
420
421
421
Create a Unicode object from a UTF-8 encoded null-terminated char buffer
422
- *u *.
422
+ *str *.
423
423
424
424
425
425
.. c :function :: PyObject* PyUnicode_FromFormat (const char *format, ...)
@@ -625,7 +625,7 @@ APIs:
625
625
.. c :function :: PyObject* PyUnicode_Substring (PyObject *unicode, Py_ssize_t start, \
626
626
Py_ssize_t end)
627
627
628
- Return a substring of *str *, from character index *start * (included) to
628
+ Return a substring of *unicode *, from character index *start * (included) to
629
629
character index *end* (excluded). Negative indices are not supported.
630
630
631
631
.. versionadded:: 3.3
@@ -637,7 +637,7 @@ APIs:
637
637
Copy the string *u * into a UCS4 buffer, including a null character, if
638
638
*copy_null * is set. Returns ``NULL `` and sets an exception on error (in
639
639
particular, a :exc: `SystemError ` if *buflen * is smaller than the length of
640
- *u *). *buffer* is returned on success.
640
+ *unicode *). *buffer* is returned on success.
641
641
642
642
.. versionadded:: 3.3
643
643
@@ -924,15 +924,15 @@ wchar_t Support
924
924
925
925
.. c :function :: PyObject* PyUnicode_FromWideChar (const wchar_t *str, Py_ssize_t size)
926
926
927
- Create a Unicode object from the :c:type: `wchar_t ` buffer *w * of the given *size *.
927
+ Create a Unicode object from the :c:type: `wchar_t ` buffer *str * of the given *size *.
928
928
Passing ``-1 `` as the *size * indicates that the function must itself compute the length,
929
929
using wcslen.
930
930
Return ``NULL `` on failure.
931
931
932
932
933
933
.. c :function :: Py_ssize_t PyUnicode_AsWideChar (PyObject *unicode, wchar_t *str, Py_ssize_t size)
934
934
935
- Copy the Unicode object contents into the :c:type: `wchar_t ` buffer *w *. At most
935
+ Copy the Unicode object contents into the :c:type: `wchar_t ` buffer *unicode *. At most
936
936
*size * :c:type: `wchar_t ` characters are copied (excluding a possibly trailing
937
937
null termination character). Return the number of :c:type:`wchar_t` characters
938
938
copied or ``-1`` in case of an error. Note that the resulting :c:type:`wchar_t*`
@@ -1002,7 +1002,7 @@ These are the generic codec APIs:
1002
1002
.. c:function:: PyObject* PyUnicode_Decode(const char *str, Py_ssize_t size, \
1003
1003
const char *encoding, const char *errors)
1004
1004
1005
- Create a Unicode object by decoding *size * bytes of the encoded string *s *.
1005
+ Create a Unicode object by decoding *size * bytes of the encoded string *str *.
1006
1006
*encoding * and *errors * have the same meaning as the parameters of the same name
1007
1007
in the :func: `str ` built-in function. The codec to be used is looked up
1008
1008
using the Python codec registry. Return ``NULL `` if an exception was raised by
@@ -1022,7 +1022,7 @@ These are the generic codec APIs:
1022
1022
.. c :function :: PyObject* PyUnicode_Encode (const Py_UNICODE *str, Py_ssize_t size, \
1023
1023
const char *encoding, const char *errors)
1024
1024
1025
- Encode the :c:type: `Py_UNICODE ` buffer *s * of the given *size * and return a Python
1025
+ Encode the :c:type: `Py_UNICODE ` buffer *str * of the given *size * and return a Python
1026
1026
bytes object. *encoding * and *errors * have the same meaning as the
1027
1027
parameters of the same name in the Unicode :meth: `~str.encode ` method. The codec
1028
1028
to be used is looked up using the Python codec registry. Return ``NULL `` if an
@@ -1158,7 +1158,7 @@ These are the UTF-32 codec APIs:
1158
1158
const char *errors, int byteorder)
1159
1159
1160
1160
Return a Python bytes object holding the UTF-32 encoded value of the Unicode
1161
- data in *s *. Output is written according to the following byte order::
1161
+ data in *str *. Output is written according to the following byte order::
1162
1162
1163
1163
byteorder == -1: little endian
1164
1164
byteorder == 0: native byte order (writes a BOM mark)
@@ -1232,7 +1232,7 @@ These are the UTF-16 codec APIs:
1232
1232
const char *errors, int byteorder)
1233
1233
1234
1234
Return a Python bytes object holding the UTF-16 encoded value of the Unicode
1235
- data in *s *. Output is written according to the following byte order::
1235
+ data in *str *. Output is written according to the following byte order::
1236
1236
1237
1237
byteorder == -1: little endian
1238
1238
byteorder == 0: native byte order (writes a BOM mark)
@@ -1609,15 +1609,15 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
1609
1609
.. c :function :: Py_ssize_t PyUnicode_Tailmatch (PyObject *unicode, PyObject *substr, \
1610
1610
Py_ssize_t start, Py_ssize_t end, int direction)
1611
1611
1612
- Return ``1 `` if *substr * matches ``str [start:end] `` at the given tail end
1612
+ Return ``1 `` if *substr * matches ``unicode [start:end] `` at the given tail end
1613
1613
(*direction * == ``-1 `` means to do a prefix match, *direction * == ``1 `` a suffix match),
1614
1614
``0`` otherwise. Return ``-1`` if an error occurred.
1615
1615
1616
1616
1617
1617
.. c:function:: Py_ssize_t PyUnicode_Find(PyObject *unicode, PyObject *substr, \
1618
1618
Py_ssize_t start, Py_ssize_t end, int direction)
1619
1619
1620
- Return the first position of *substr * in ``str [start:end] `` using the given
1620
+ Return the first position of *substr * in ``unicode [start:end] `` using the given
1621
1621
*direction * (*direction * == ``1 `` means to do a forward search, *direction * == ``-1 `` a
1622
1622
backward search). The return value is the index of the first match; a value of
1623
1623
``-1 `` indicates that no match was found, and ``-2 `` indicates that an error
@@ -1627,7 +1627,7 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
1627
1627
.. c :function :: Py_ssize_t PyUnicode_FindChar (PyObject *unicode, Py_UCS4 ch, \
1628
1628
Py_ssize_t start, Py_ssize_t end, int direction)
1629
1629
1630
- Return the first position of the character *ch * in ``str [start:end] `` using
1630
+ Return the first position of the character *ch * in ``unicode [start:end] `` using
1631
1631
the given *direction * (*direction * == ``1 `` means to do a forward search,
1632
1632
*direction * == ``-1 `` a backward search). The return value is the index of the
1633
1633
first match; a value of ``-1 `` indicates that no match was found, and ``-2 ``
@@ -1636,20 +1636,20 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
1636
1636
.. versionadded :: 3.3
1637
1637
1638
1638
.. versionchanged :: 3.7
1639
- *start * and *end * are now adjusted to behave like ``str [start:end] ``.
1639
+ *start * and *end * are now adjusted to behave like ``unicode [start:end] ``.
1640
1640
1641
1641
1642
1642
.. c :function :: Py_ssize_t PyUnicode_Count (PyObject *unicode, PyObject *substr, \
1643
1643
Py_ssize_t start, Py_ssize_t end)
1644
1644
1645
1645
Return the number of non-overlapping occurrences of *substr * in
1646
- ``str [start:end] ``. Return ``-1 `` if an error occurred.
1646
+ ``unicode [start:end] ``. Return ``-1 `` if an error occurred.
1647
1647
1648
1648
1649
1649
.. c :function :: PyObject* PyUnicode_Replace (PyObject *unicode, PyObject *substr, \
1650
1650
PyObject *replstr, Py_ssize_t maxcount)
1651
1651
1652
- Replace at most *maxcount * occurrences of *substr * in *str * with *replstr * and
1652
+ Replace at most *maxcount * occurrences of *substr * in *unicode * with *replstr * and
1653
1653
return the resulting Unicode object. *maxcount * == ``-1 `` means replace all
1654
1654
occurrences.
1655
1655
@@ -1707,7 +1707,7 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
1707
1707
existing interned string that is the same as *\* string *, it sets *\* string * to
1708
1708
it (decrementing the reference count of the old string object and incrementing
1709
1709
the reference count of the interned string object), otherwise it leaves
1710
- *\*string * alone and interns it (incrementing its reference count).
1710
+ *\*p_unicode * alone and interns it (incrementing its reference count).
1711
1711
(Clarification: even though there is a lot of talk about reference counts, think
1712
1712
of this function as reference-count-neutral; you own the object after the call
1713
1713
if and only if you owned it before the call.)
0 commit comments