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
|
PyUnicode_FromUnicode remains supported but is deprecated. If the
|
||||||
Py_UNICODE pointer is non-null, the data representation is set. 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,
|
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
|
or implicitly). Resizing a Unicode string remains possible until it
|
||||||
is finalized.
|
is finalized.
|
||||||
|
|
||||||
|
@ -192,10 +192,9 @@ should use PyUnicode_{READ|WRITE}[_CHAR]:
|
||||||
- PyUnciode_READ(kind, data, index)
|
- PyUnciode_READ(kind, data, index)
|
||||||
- PyUnicode_WRITE(kind, data, index, value)
|
- PyUnicode_WRITE(kind, data, index, value)
|
||||||
- PyUnicode_READ_CHAR(unicode, index)
|
- PyUnicode_READ_CHAR(unicode, index)
|
||||||
- PyUnicode_WRITE_CHAR(unicode, index, value)
|
|
||||||
|
|
||||||
All these macros assume that the string is in canonical form;
|
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
|
A new function PyUnicode_AsUTF8 is provided to access the UTF-8
|
||||||
representation. It is thus identical to the existing
|
representation. It is thus identical to the existing
|
||||||
|
@ -231,14 +230,13 @@ Character access macros:
|
||||||
Other macros:
|
Other macros:
|
||||||
|
|
||||||
- PyUnicode_READY(o)
|
- 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:
|
String creation functions:
|
||||||
|
|
||||||
- PyUnicode_New(size, maxchar)
|
- PyUnicode_New(size, maxchar)
|
||||||
- PyUnicode_FromKindAndData(kind, data, size)
|
- PyUnicode_FromKindAndData(kind, data, size)
|
||||||
- PyUnicode_Substring(o, start, end)
|
- PyUnicode_Substring(o, start, end)
|
||||||
- PyUnicode_Chr(ch)
|
|
||||||
|
|
||||||
Character access utility functions:
|
Character access utility functions:
|
||||||
|
|
||||||
|
@ -265,8 +263,9 @@ Stable ABI
|
||||||
|
|
||||||
The following functions are added to the stable ABI (PEP 384), as they
|
The following functions are added to the stable ABI (PEP 384), as they
|
||||||
are independent of the actual representation of Unicode objects:
|
are independent of the actual representation of Unicode objects:
|
||||||
PyUnicode_New, PyUnicode_Chr, PyUnicode_GetLength, PyUnicode_ReadChar,
|
PyUnicode_New, PyUnicode_Substring, PyUnicode_GetLength,
|
||||||
PyUnicode_WriteChar, PyUnicode_Find, PyUnicode_FindChar.
|
PyUnicode_ReadChar, PyUnicode_WriteChar, PyUnicode_Find,
|
||||||
|
PyUnicode_FindChar.
|
||||||
|
|
||||||
GDB Debugging Hooks
|
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
|
deprecated API even in new code is for code that shall work both on
|
||||||
Python 2 and Python 3.
|
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
|
_PyUnicode_AsDefaultEncodedString is removed. It previously returned a
|
||||||
borrowed reference to an UTF-8-encoded bytes object. Since the unicode
|
borrowed reference to an UTF-8-encoded bytes object. Since the unicode
|
||||||
object cannot anymore cache such a reference, implementing it without
|
object cannot anymore cache such a reference, implementing it without
|
||||||
|
@ -371,7 +386,7 @@ the use of these API elements:
|
||||||
|
|
||||||
- the Py_UNICODE type,
|
- the Py_UNICODE type,
|
||||||
- PyUnicode_AS_UNICODE and PyUnicode_AsUnicode,
|
- PyUnicode_AS_UNICODE and PyUnicode_AsUnicode,
|
||||||
- PyUnicode_GET_LENGTH and PyUnicode_GetSize, and
|
- PyUnicode_GET_SIZE and PyUnicode_GetSize, and
|
||||||
- PyUnicode_FromUnicode.
|
- PyUnicode_FromUnicode.
|
||||||
|
|
||||||
When iterating over an existing string, or looking at specific
|
When iterating over an existing string, or looking at specific
|
||||||
|
|
Loading…
Reference in New Issue