bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)

See PEP 623 for detail.
(cherry picked from commit 270b4ad4df)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-08-04 18:57:10 -07:00 committed by GitHub
parent 46e448abbf
commit f0e030cacb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 9 deletions

View File

@ -34,6 +34,11 @@ can internally be in two states depending on how they were created:
:c:type:`Py_UNICODE*` representation; you will have to call :c:type:`Py_UNICODE*` representation; you will have to call
:c:func:`PyUnicode_READY` on them before calling any other API. :c:func:`PyUnicode_READY` on them before calling any other API.
.. note::
The "legacy" Unicode object will be removed in Python 3.12 with deprecated
APIs. All Unicode objects will be "canonical" since then. See :pep:`623`
for more information.
Unicode Type Unicode Type
"""""""""""" """"""""""""
@ -107,6 +112,9 @@ access internal read-only data of Unicode objects:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. deprecated-removed:: 3.10 3.12
This API will be removed with :c:func:`PyUnicode_FromUnicode`.
.. c:function:: Py_ssize_t PyUnicode_GET_LENGTH(PyObject *o) .. c:function:: Py_ssize_t PyUnicode_GET_LENGTH(PyObject *o)
@ -138,6 +146,9 @@ access internal read-only data of Unicode objects:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. deprecated-removed:: 3.10 3.12
``PyUnicode_WCHAR_KIND`` is deprecated.
.. c:function:: int PyUnicode_KIND(PyObject *o) .. c:function:: int PyUnicode_KIND(PyObject *o)
@ -208,7 +219,7 @@ access internal read-only data of Unicode objects:
code units (this includes surrogate pairs as 2 units). *o* has to be a code units (this includes surrogate pairs as 2 units). *o* has to be a
Unicode object (not checked). Unicode object (not checked).
.. deprecated-removed:: 3.3 4.0 .. deprecated-removed:: 3.3 3.12
Part of the old-style Unicode API, please migrate to using Part of the old-style Unicode API, please migrate to using
:c:func:`PyUnicode_GET_LENGTH`. :c:func:`PyUnicode_GET_LENGTH`.
@ -218,7 +229,7 @@ access internal read-only data of Unicode objects:
Return the size of the deprecated :c:type:`Py_UNICODE` representation in Return the size of the deprecated :c:type:`Py_UNICODE` representation in
bytes. *o* has to be a Unicode object (not checked). bytes. *o* has to be a Unicode object (not checked).
.. deprecated-removed:: 3.3 4.0 .. deprecated-removed:: 3.3 3.12
Part of the old-style Unicode API, please migrate to using Part of the old-style Unicode API, please migrate to using
:c:func:`PyUnicode_GET_LENGTH`. :c:func:`PyUnicode_GET_LENGTH`.
@ -240,7 +251,7 @@ access internal read-only data of Unicode objects:
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
:c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`. :c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`.
.. deprecated-removed:: 3.3 4.0 .. deprecated-removed:: 3.3 3.12
Part of the old-style Unicode API, please migrate to using the Part of the old-style Unicode API, please migrate to using the
:c:func:`PyUnicode_nBYTE_DATA` family of macros. :c:func:`PyUnicode_nBYTE_DATA` family of macros.
@ -682,8 +693,10 @@ Extension modules can continue using them, as they will not be removed in Python
string content has been filled before using any of the access macros such as string content has been filled before using any of the access macros such as
:c:func:`PyUnicode_KIND`. :c:func:`PyUnicode_KIND`.
Please migrate to using :c:func:`PyUnicode_FromKindAndData`, .. deprecated-removed:: 3.3 3.12
:c:func:`PyUnicode_FromWideChar` or :c:func:`PyUnicode_New`. Part of the old-style Unicode API, please migrate to using
:c:func:`PyUnicode_FromKindAndData`, :c:func:`PyUnicode_FromWideChar`, or
:c:func:`PyUnicode_New`.
.. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode) .. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
@ -696,9 +709,10 @@ Extension modules can continue using them, as they will not be removed in Python
embedded null code points, which would cause the string to be truncated when embedded null code points, which would cause the string to be truncated when
used in most C functions. used in most C functions.
Please migrate to using :c:func:`PyUnicode_AsUCS4`, .. deprecated-removed:: 3.3 3.12
:c:func:`PyUnicode_AsWideChar`, :c:func:`PyUnicode_ReadChar` or similar new Part of the old-style Unicode API, please migrate to using
APIs. :c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`,
:c:func:`PyUnicode_ReadChar` or similar new APIs.
.. deprecated-removed:: 3.3 3.10 .. deprecated-removed:: 3.3 3.10
@ -720,6 +734,11 @@ Extension modules can continue using them, as they will not be removed in Python
.. versionadded:: 3.3 .. versionadded:: 3.3
.. deprecated-removed:: 3.3 3.12
Part of the old-style Unicode API, please migrate to using
:c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`,
:c:func:`PyUnicode_ReadChar` or similar new APIs.
.. c:function:: Py_UNICODE* PyUnicode_AsUnicodeCopy(PyObject *unicode) .. c:function:: Py_UNICODE* PyUnicode_AsUnicodeCopy(PyObject *unicode)
@ -740,7 +759,9 @@ Extension modules can continue using them, as they will not be removed in Python
Return the size of the deprecated :c:type:`Py_UNICODE` representation, in Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
code units (this includes surrogate pairs as 2 units). code units (this includes surrogate pairs as 2 units).
Please migrate to using :c:func:`PyUnicode_GetLength`. .. deprecated-removed:: 3.3 3.12
Part of the old-style Unicode API, please migrate to using
:c:func:`PyUnicode_GET_LENGTH`.
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj) .. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)