[Python-checkins] peps: Drop implicit FAST_READY calls.
martin.v.loewis
python-checkins at python.org
Sat Aug 27 10:05:45 CEST 2011
http://hg.python.org/peps/rev/5930405e515d
changeset: 3933:5930405e515d
user: Martin v. Löwis <martin at v.loewis.de>
date: Sat Aug 27 10:05:42 2011 +0200
summary:
Drop implicit FAST_READY calls.
files:
pep-0393.txt | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pep-0393.txt b/pep-0393.txt
--- a/pep-0393.txt
+++ b/pep-0393.txt
@@ -138,7 +138,9 @@
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 @@
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
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list