Skip to content

Commit 1218061

Browse files
author
Erlend Egeberg Aasland
authored
gh-89653: PEP 670: Amend docs (GH-91813)
1 parent 9e146bb commit 1218061

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

Doc/c-api/list.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ List Objects
5353
5454
.. c:function:: Py_ssize_t PyList_GET_SIZE(PyObject *list)
5555
56-
Macro form of :c:func:`PyList_Size` without error checking.
56+
Similar to :c:func:`PyList_Size`, but without error checking.
5757
5858
5959
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
@@ -66,7 +66,7 @@ List Objects
6666
6767
.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
6868
69-
Macro form of :c:func:`PyList_GetItem` without error checking.
69+
Similar to :c:func:`PyList_GetItem`, but without error checking.
7070
7171
7272
.. c:function:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)

Doc/c-api/tuple.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Tuple Objects
9191
9292
.. note::
9393
94-
This macro "steals" a reference to *o*, and, unlike
94+
This function "steals" a reference to *o*, and, unlike
9595
:c:func:`PyTuple_SetItem`, does *not* discard a reference to any item that
9696
is being replaced; any reference in the tuple at position *pos* will be
9797
leaked.
@@ -215,7 +215,8 @@ type.
215215
216216
.. c:function:: void PyStructSequence_SET_ITEM(PyObject *p, Py_ssize_t *pos, PyObject *o)
217217
218-
Macro equivalent of :c:func:`PyStructSequence_SetItem`.
218+
Similar to :c:func:`PyStructSequence_SetItem`, but implemented as a static
219+
inlined function.
219220
220221
.. note::
221222

Doc/c-api/unicode.rst

+12-11
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Python:
8484
is exposed to Python code as ``str``.
8585

8686

87-
The following APIs are really C macros and can be used to do fast checks and to
88-
access internal read-only data of Unicode objects:
87+
The following APIs are C macros and static inlined functions for fast checks and
88+
access to internal read-only data of Unicode objects:
8989

9090
.. c:function:: int PyUnicode_Check(PyObject *o)
9191
@@ -168,20 +168,21 @@ access internal read-only data of Unicode objects:
168168
.. versionadded:: 3.3
169169
170170
171-
.. c:function:: void PyUnicode_WRITE(int kind, void *data, Py_ssize_t index, \
172-
Py_UCS4 value)
171+
.. c:function:: void PyUnicode_WRITE(unsigned int kind, void *data, \
172+
Py_ssize_t index, Py_UCS4 value)
173173
174174
Write into a canonical representation *data* (as obtained with
175-
:c:func:`PyUnicode_DATA`). This macro does not do any sanity checks and is
175+
:c:func:`PyUnicode_DATA`). This function performs no sanity checks, and is
176176
intended for usage in loops. The caller should cache the *kind* value and
177-
*data* pointer as obtained from other macro calls. *index* is the index in
177+
*data* pointer as obtained from other calls. *index* is the index in
178178
the string (starts at 0) and *value* is the new code point value which should
179179
be written to that location.
180180
181181
.. versionadded:: 3.3
182182
183183
184-
.. c:function:: Py_UCS4 PyUnicode_READ(int kind, void *data, Py_ssize_t index)
184+
.. c:function:: Py_UCS4 PyUnicode_READ(unsigned int kind, void *data, \
185+
Py_ssize_t index)
185186
186187
Read a code point from a canonical representation *data* (as obtained with
187188
:c:func:`PyUnicode_DATA`). No checks or ready calls are performed.
@@ -198,7 +199,7 @@ access internal read-only data of Unicode objects:
198199
.. versionadded:: 3.3
199200
200201
201-
.. c:macro:: PyUnicode_MAX_CHAR_VALUE(o)
202+
.. c:function:: Py_UCS4 PyUnicode_MAX_CHAR_VALUE(PyObject *o)
202203
203204
Return the maximum code point that is suitable for creating another string
204205
based on *o*, which must be in the "canonical" representation. This is
@@ -239,7 +240,7 @@ access internal read-only data of Unicode objects:
239240
a Unicode object (not checked).
240241
241242
.. versionchanged:: 3.3
242-
This macro is now inefficient -- because in many cases the
243+
This function is now inefficient -- because in many cases the
243244
:c:type:`Py_UNICODE` representation does not exist and needs to be created
244245
-- and can fail (return ``NULL`` with an exception set). Try to port the
245246
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
@@ -642,8 +643,8 @@ APIs:
642643
.. c:function:: Py_UCS4 PyUnicode_ReadChar(PyObject *unicode, Py_ssize_t index)
643644
644645
Read a character from a string. This function checks that *unicode* is a
645-
Unicode object and the index is not out of bounds, in contrast to the macro
646-
version :c:func:`PyUnicode_READ_CHAR`.
646+
Unicode object and the index is not out of bounds, in contrast to
647+
:c:func:`PyUnicode_READ_CHAR`, which performs no error checking.
647648
648649
.. versionadded:: 3.3
649650

Doc/c-api/weakref.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ as much as it can.
6666
6767
.. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
6868
69-
Similar to :c:func:`PyWeakref_GetObject`, but implemented as a macro that does no
70-
error checking.
69+
Similar to :c:func:`PyWeakref_GetObject`, but does no error checking.

0 commit comments

Comments
 (0)