Address Victor's comments.
This commit is contained in:
parent
f6358363d0
commit
735b7589a0
31
pep-0393.txt
31
pep-0393.txt
|
@ -169,7 +169,7 @@ representation is not yet set for the string.
|
|||
PyUnicode_FromUnicode remains supported but is deprecated. If the
|
||||
Py_UNICODE pointer is non-null, the data representation is set. If the
|
||||
pointer is NULL, a properly-sized wstr representation is allocated,
|
||||
which can be modified until PyUnicode_Ready() is called (explicitly
|
||||
which can be modified until PyUnicode_READY() is called (explicitly
|
||||
or implicitly). Resizing a Unicode string remains possible until it
|
||||
is finalized.
|
||||
|
||||
|
@ -192,10 +192,9 @@ 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.
|
||||
callers need to ensure this by calling PyUnicode_READY.
|
||||
|
||||
A new function PyUnicode_AsUTF8 is provided to access the UTF-8
|
||||
representation. It is thus identical to the existing
|
||||
|
@ -231,14 +230,13 @@ Character access macros:
|
|||
Other macros:
|
||||
|
||||
- PyUnicode_READY(o)
|
||||
- PyUnicode_CONVERT_BYTES(from_type, tp_type, begin, end, to)
|
||||
- PyUnicode_CONVERT_BYTES(from_type, to_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:
|
||||
|
||||
|
@ -265,8 +263,9 @@ Stable ABI
|
|||
|
||||
The following functions are added to the stable ABI (PEP 384), as they
|
||||
are independent of the actual representation of Unicode objects:
|
||||
PyUnicode_New, PyUnicode_Chr, PyUnicode_GetLength, PyUnicode_ReadChar,
|
||||
PyUnicode_WriteChar, PyUnicode_Find, PyUnicode_FindChar.
|
||||
PyUnicode_New, PyUnicode_Substring, PyUnicode_GetLength,
|
||||
PyUnicode_ReadChar, PyUnicode_WriteChar, PyUnicode_Find,
|
||||
PyUnicode_FindChar.
|
||||
|
||||
GDB Debugging Hooks
|
||||
-------------------
|
||||
|
@ -286,6 +285,22 @@ been ported to the new API. A reasonable motivation for using the
|
|||
deprecated API even in new code is for code that shall work both on
|
||||
Python 2 and Python 3.
|
||||
|
||||
The following macros and functions are deprecated:
|
||||
|
||||
- PyUnicode_FromUnicode
|
||||
- PyUnicode_GET_SIZE, PyUnicode_GetSize, PyUnicode_GET_DATA_SIZE,
|
||||
- PyUnicode_AS_UNICODE, PyUnicode_AsUnicode, PyUnicode_AsUnicodeAndSize
|
||||
- PyUnicode_COPY, PyUnicode_FILL, PyUnicode_MATCH
|
||||
- PyUnicode_Encode, PyUnicode_EncodeUTF7, PyUnicode_EncodeUTF8,
|
||||
PyUnicode_EncodeUTF16, PyUnicode_EncodeUTF32,
|
||||
PyUnicode_EncodeUnicodeEscape, PyUnicode_EncodeRawUnicodeEscape,
|
||||
PyUnicode_EncodeLatin1, PyUnicode_EncodeASCII,
|
||||
PyUnicode_EncodeCharmap, PyUnicode_TranslateCharmap,
|
||||
PyUnicode_EncodeMBCS, PyUnicode_EncodeDecimal,
|
||||
PyUnicode_TransformDecimalToASCII
|
||||
- Py_UNICODE_{strlen, strcat, strcpy, strcmp, strchr, strrchr}
|
||||
- PyUnicode_AsUnicodeCopy
|
||||
|
||||
_PyUnicode_AsDefaultEncodedString is removed. It previously returned a
|
||||
borrowed reference to an UTF-8-encoded bytes object. Since the unicode
|
||||
object cannot anymore cache such a reference, implementing it without
|
||||
|
@ -371,7 +386,7 @@ the use of these API elements:
|
|||
|
||||
- the Py_UNICODE type,
|
||||
- PyUnicode_AS_UNICODE and PyUnicode_AsUnicode,
|
||||
- PyUnicode_GET_LENGTH and PyUnicode_GetSize, and
|
||||
- PyUnicode_GET_SIZE and PyUnicode_GetSize, and
|
||||
- PyUnicode_FromUnicode.
|
||||
|
||||
When iterating over an existing string, or looking at specific
|
||||
|
|
Loading…
Reference in New Issue