Drop implicit FAST_READY calls.

This commit is contained in:
Martin v. Löwis 2011-08-27 10:05:42 +02:00
parent f30420c210
commit 81e415ac36
1 changed files with 8 additions and 5 deletions

View File

@ -138,7 +138,9 @@ is finalized.
PyUnicode_Ready() converts a string containing only a wstr
representation into the canonical representation. Unless wstr and str
can share the memory, the wstr representation is discarded after the
conversion.
conversion. PyUnicode_FAST_READY() is a wrapper that avoids the
function call if the string is already ready. Both APIs return 0
on success and -1 on failure.
String Access
-------------
@ -147,16 +149,17 @@ The canonical representation can be accessed using two macros
PyUnicode_Kind and PyUnicode_Data. PyUnicode_Kind gives one of the
values PyUnicode_WCHAR_KIND (0), PyUnicode_1BYTE_KIND (1),
PyUnicode_2BYTE_KIND (2), or PyUnicode_4BYTE_KIND (3). PyUnicode_DATA
gives the void pointer to the data. All these functions call
PyUnicode_Ready in case the canonical representation hasn't been
computed yet. Access to individual characters should use
PyUnicode_{READ|WRITE}[_CHAR]:
gives the void pointer to the data. Access to individual characters
should use PyUnicode_{READ|WRITE}[_CHAR]:
- PyUnciode_READ(kind, data, index)
- PyUnicode_WRITE(kind, data, index, value)
- PyUnicode_READ_CHAR(unicode, index)
- PyUnicode_WRITE_CHAR(unicode, index, value)
All these macros assume that the string is in canonical form;
callers need to ensure this by calling PyUnicode_FAST_READY.
A new function PyUnicode_AsUTF8 is provided to access the UTF-8
representation. It is thus identical to the existing
_PyUnicode_AsString, which is removed. The function will compute the