Skip to content

Commit 270b4ad

Browse files
authored
bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)
See PEP 623 for detail.
1 parent 582aaf1 commit 270b4ad

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

Doc/c-api/unicode.rst

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ can internally be in two states depending on how they were created:
3434
:c:type:`Py_UNICODE*` representation; you will have to call
3535
:c:func:`PyUnicode_READY` on them before calling any other API.
3636

37+
.. note::
38+
The "legacy" Unicode object will be removed in Python 3.12 with deprecated
39+
APIs. All Unicode objects will be "canonical" since then. See :pep:`623`
40+
for more information.
41+
3742

3843
Unicode Type
3944
""""""""""""
@@ -107,6 +112,9 @@ access internal read-only data of Unicode objects:
107112
108113
.. versionadded:: 3.3
109114
115+
.. deprecated-removed:: 3.10 3.12
116+
This API will be removed with :c:func:`PyUnicode_FromUnicode`.
117+
110118
111119
.. c:function:: Py_ssize_t PyUnicode_GET_LENGTH(PyObject *o)
112120
@@ -138,6 +146,9 @@ access internal read-only data of Unicode objects:
138146
139147
.. versionadded:: 3.3
140148
149+
.. deprecated-removed:: 3.10 3.12
150+
``PyUnicode_WCHAR_KIND`` is deprecated.
151+
141152
142153
.. c:function:: int PyUnicode_KIND(PyObject *o)
143154
@@ -203,7 +214,7 @@ access internal read-only data of Unicode objects:
203214
code units (this includes surrogate pairs as 2 units). *o* has to be a
204215
Unicode object (not checked).
205216
206-
.. deprecated-removed:: 3.3 4.0
217+
.. deprecated-removed:: 3.3 3.12
207218
Part of the old-style Unicode API, please migrate to using
208219
:c:func:`PyUnicode_GET_LENGTH`.
209220
@@ -213,7 +224,7 @@ access internal read-only data of Unicode objects:
213224
Return the size of the deprecated :c:type:`Py_UNICODE` representation in
214225
bytes. *o* has to be a Unicode object (not checked).
215226
216-
.. deprecated-removed:: 3.3 4.0
227+
.. deprecated-removed:: 3.3 3.12
217228
Part of the old-style Unicode API, please migrate to using
218229
:c:func:`PyUnicode_GET_LENGTH`.
219230
@@ -235,7 +246,7 @@ access internal read-only data of Unicode objects:
235246
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
236247
:c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`.
237248
238-
.. deprecated-removed:: 3.3 4.0
249+
.. deprecated-removed:: 3.3 3.12
239250
Part of the old-style Unicode API, please migrate to using the
240251
:c:func:`PyUnicode_nBYTE_DATA` family of macros.
241252
@@ -687,8 +698,10 @@ Extension modules can continue using them, as they will not be removed in Python
687698
string content has been filled before using any of the access macros such as
688699
:c:func:`PyUnicode_KIND`.
689700
690-
Please migrate to using :c:func:`PyUnicode_FromKindAndData`,
691-
:c:func:`PyUnicode_FromWideChar` or :c:func:`PyUnicode_New`.
701+
.. deprecated-removed:: 3.3 3.12
702+
Part of the old-style Unicode API, please migrate to using
703+
:c:func:`PyUnicode_FromKindAndData`, :c:func:`PyUnicode_FromWideChar`, or
704+
:c:func:`PyUnicode_New`.
692705
693706
694707
.. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
@@ -701,9 +714,10 @@ Extension modules can continue using them, as they will not be removed in Python
701714
embedded null code points, which would cause the string to be truncated when
702715
used in most C functions.
703716
704-
Please migrate to using :c:func:`PyUnicode_AsUCS4`,
705-
:c:func:`PyUnicode_AsWideChar`, :c:func:`PyUnicode_ReadChar` or similar new
706-
APIs.
717+
.. deprecated-removed:: 3.3 3.12
718+
Part of the old-style Unicode API, please migrate to using
719+
:c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`,
720+
:c:func:`PyUnicode_ReadChar` or similar new APIs.
707721
708722
709723
.. c:function:: PyObject* PyUnicode_TransformDecimalToASCII(Py_UNICODE *s, Py_ssize_t size)
@@ -723,13 +737,20 @@ Extension modules can continue using them, as they will not be removed in Python
723737
724738
.. versionadded:: 3.3
725739
740+
.. deprecated-removed:: 3.3 3.12
741+
Part of the old-style Unicode API, please migrate to using
742+
:c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`,
743+
:c:func:`PyUnicode_ReadChar` or similar new APIs.
744+
726745
727746
.. c:function:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
728747
729748
Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
730749
code units (this includes surrogate pairs as 2 units).
731750
732-
Please migrate to using :c:func:`PyUnicode_GetLength`.
751+
.. deprecated-removed:: 3.3 3.12
752+
Part of the old-style Unicode API, please migrate to using
753+
:c:func:`PyUnicode_GET_LENGTH`.
733754
734755
735756
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)

0 commit comments

Comments
 (0)