@@ -84,8 +84,8 @@ Python:
84
84
is exposed to Python code as ``str ``.
85
85
86
86
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:
89
89
90
90
.. c :function :: int PyUnicode_Check (PyObject *o)
91
91
@@ -168,20 +168,21 @@ access internal read-only data of Unicode objects:
168
168
.. versionadded:: 3.3
169
169
170
170
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)
173
173
174
174
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
176
176
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
178
178
the string (starts at 0) and *value* is the new code point value which should
179
179
be written to that location.
180
180
181
181
.. versionadded:: 3.3
182
182
183
183
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)
185
186
186
187
Read a code point from a canonical representation *data * (as obtained with
187
188
:c:func: `PyUnicode_DATA `). No checks or ready calls are performed.
@@ -198,7 +199,7 @@ access internal read-only data of Unicode objects:
198
199
.. versionadded :: 3.3
199
200
200
201
201
- .. c :macro :: PyUnicode_MAX_CHAR_VALUE(o)
202
+ .. c :function :: Py_UCS4 PyUnicode_MAX_CHAR_VALUE (PyObject * o)
202
203
203
204
Return the maximum code point that is suitable for creating another string
204
205
based on *o *, which must be in the "canonical" representation. This is
@@ -239,7 +240,7 @@ access internal read-only data of Unicode objects:
239
240
a Unicode object (not checked).
240
241
241
242
.. 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
243
244
:c:type:`Py_UNICODE` representation does not exist and needs to be created
244
245
-- and can fail (return ``NULL `` with an exception set). Try to port the
245
246
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
@@ -642,8 +643,8 @@ APIs:
642
643
.. c:function:: Py_UCS4 PyUnicode_ReadChar(PyObject *unicode, Py_ssize_t index)
643
644
644
645
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 .
647
648
648
649
.. versionadded :: 3.3
649
650
0 commit comments