PyUnicode_READ_CHAR() ensures that the string is ready
This commit is contained in:
parent
fe0c155c4f
commit
37943769ef
@ -429,14 +429,16 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
|
|||||||
PyUnicode_READ_CHAR, for multiple consecutive reads callers should
|
PyUnicode_READ_CHAR, for multiple consecutive reads callers should
|
||||||
cache kind and use PyUnicode_READ instead. */
|
cache kind and use PyUnicode_READ instead. */
|
||||||
#define PyUnicode_READ_CHAR(unicode, index) \
|
#define PyUnicode_READ_CHAR(unicode, index) \
|
||||||
((Py_UCS4) \
|
(assert(PyUnicode_Check(unicode)), \
|
||||||
(PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
|
assert(PyUnicode_IS_READY(unicode)), \
|
||||||
((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
(Py_UCS4) \
|
||||||
(PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
|
(PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
|
||||||
((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
||||||
((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \
|
(PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
|
||||||
) \
|
((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
||||||
))
|
((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \
|
||||||
|
) \
|
||||||
|
))
|
||||||
|
|
||||||
/* Returns the length of the unicode string. The caller has to make sure that
|
/* Returns the length of the unicode string. The caller has to make sure that
|
||||||
the string has it's canonical representation set before calling
|
the string has it's canonical representation set before calling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user