[Python-checkins] peps: Address GvR's comments.

martin.v.loewis python-checkins at python.org
Mon Sep 26 12:25:54 CEST 2011


http://hg.python.org/peps/rev/81a533fd93f2
changeset:   3945:81a533fd93f2
user:        Martin v. Löwis <martin at v.loewis.de>
date:        Mon Sep 26 12:25:49 2011 +0200
summary:
  Address GvR's comments.

files:
  pep-0393.txt |  63 ++++++++++++++++++++++++++++++++++++++-
  1 files changed, 61 insertions(+), 2 deletions(-)


diff --git a/pep-0393.txt b/pep-0393.txt
--- a/pep-0393.txt
+++ b/pep-0393.txt
@@ -19,7 +19,8 @@
 representation in common cases, but give access to full UCS-4 on all
 systems. For compatibility with existing APIs, several representations
 may exist in parallel; over time, this compatibility should be phased
-out.
+out. The distinction between narrow and wide Unicode builds is
+dropped.  An implementation of this PEP is available at [1]_.
 
 Rationale
 =========
@@ -206,10 +207,62 @@
 converts a string to a char* (such as the ParseTuple functions) will
 use PyUnicode_AsUTF8 to compute a conversion.
 
+New API
+-------
+
+This section summarizes the API additions.
+
+Macros to access the internal representation of a Unicode object
+(read-only):
+
+- PyUnicode_IS_COMPACT_ASCII(o), PyUnicode_IS_COMPACT(o),
+  PyUnicode_IS_READY(o)
+- PyUnicode_GET_LENGTH(o)
+- PyUnicode_KIND(o), PyUnicode_CHARACTER_SIZE(o),
+  PyUnicode_MAX_CHAR_VALUE(o)
+- PyUnicode_DATA(o), PyUnicode_1BYTE_DATA(o), PyUnicode_2BYTE_DATA(o),
+  PyUnicode_4BYTE_DATA(o)
+
+Character access macros:
+
+- PyUnicode_READ(kind, data, index), PyUnicode_READ_CHAR(o, index)
+- PyUnicode_WRITE(kind, data, index, value)
+
+Other macros:
+
+- PyUnicode_READY(o)
+- PyUnicode_CONVERT_BYTES(from_type, tp_type, begin, end, to)
+
+String creation functions:
+
+- PyUnicode_New(size, maxchar)
+- PyUnicode_FromKindAndData(kind, data, size)
+- PyUnicode_Substring(o, start, end)
+- PyUnicode_Chr(ch)
+
+Character access utility functions:
+
+- PyUnicode_CopyCharacters(to, to_start, from, from_start, how_many)
+- PyUnicode_FindChar(str, ch, start, end, direction)
+
+Representation conversion:
+
+- PyUnicode_AsUCS4(o, buffer, buflen)
+- PyUnicode_AsUCS4Copy(o)
+- PyUnicode_AsUnicodeAndSize(o, size_out)
+- PyUnicode_AsUTF8(o)
+- PyUnicode_AsUTF8AndSize(o, size_out)
+
+UCS4 utility functions:
+
+- Py_UCS4_{strlen, strcpy, strcat, strncpy, strcmp, strncpy, strcmp,
+  strncmp, strchr, strrchr}
+
 Stable ABI
 ----------
 
-None of the functions in this PEP become part of the stable ABI.
+None of the functions in this PEP become part of the stable ABI
+(PEP 384).
 
 GDB Debugging Hooks
 -------------------
@@ -363,6 +416,12 @@
 PyUnicode_CopyCharacters help in analyzing and creating string
 objects, operating on indices instead of data pointers.
 
+References
+==========
+
+.. [1] PEP 393 branch
+       https://bitbucket.org/t0rsten/pep-393
+
 Copyright
 =========
 

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list