@@ -34,6 +34,11 @@ can internally be in two states depending on how they were created:
34
34
:c:type: `Py_UNICODE* ` representation; you will have to call
35
35
:c:func: `PyUnicode_READY ` on them before calling any other API.
36
36
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
+
37
42
38
43
Unicode Type
39
44
""""""""""""
@@ -107,6 +112,9 @@ access internal read-only data of Unicode objects:
107
112
108
113
.. versionadded :: 3.3
109
114
115
+ .. deprecated-removed :: 3.10 3.12
116
+ This API will be removed with :c:func: `PyUnicode_FromUnicode `.
117
+
110
118
111
119
.. c :function :: Py_ssize_t PyUnicode_GET_LENGTH (PyObject *o)
112
120
@@ -138,6 +146,9 @@ access internal read-only data of Unicode objects:
138
146
139
147
.. versionadded :: 3.3
140
148
149
+ .. deprecated-removed :: 3.10 3.12
150
+ ``PyUnicode_WCHAR_KIND `` is deprecated.
151
+
141
152
142
153
.. c :function :: int PyUnicode_KIND (PyObject *o)
143
154
@@ -203,7 +214,7 @@ access internal read-only data of Unicode objects:
203
214
code units (this includes surrogate pairs as 2 units). *o* has to be a
204
215
Unicode object (not checked).
205
216
206
- .. deprecated-removed:: 3.3 4.0
217
+ .. deprecated-removed:: 3.3 3.12
207
218
Part of the old-style Unicode API, please migrate to using
208
219
:c:func:`PyUnicode_GET_LENGTH`.
209
220
@@ -213,7 +224,7 @@ access internal read-only data of Unicode objects:
213
224
Return the size of the deprecated :c:type: `Py_UNICODE ` representation in
214
225
bytes. *o * has to be a Unicode object (not checked).
215
226
216
- .. deprecated-removed:: 3.3 4.0
227
+ .. deprecated-removed:: 3.3 3.12
217
228
Part of the old-style Unicode API, please migrate to using
218
229
:c:func:`PyUnicode_GET_LENGTH`.
219
230
@@ -235,7 +246,7 @@ access internal read-only data of Unicode objects:
235
246
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
236
247
:c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`.
237
248
238
- .. deprecated-removed:: 3.3 4.0
249
+ .. deprecated-removed:: 3.3 3.12
239
250
Part of the old-style Unicode API, please migrate to using the
240
251
:c:func:`PyUnicode_nBYTE_DATA` family of macros.
241
252
@@ -687,8 +698,10 @@ Extension modules can continue using them, as they will not be removed in Python
687
698
string content has been filled before using any of the access macros such as
688
699
:c:func: `PyUnicode_KIND `.
689
700
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 `.
692
705
693
706
694
707
.. 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
701
714
embedded null code points, which would cause the string to be truncated when
702
715
used in most C functions.
703
716
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.
707
721
708
722
709
723
.. 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
723
737
724
738
.. versionadded:: 3.3
725
739
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
+
726
745
727
746
.. c:function:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
728
747
729
748
Return the size of the deprecated :c:type: `Py_UNICODE ` representation, in
730
749
code units (this includes surrogate pairs as 2 units).
731
750
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`.
733
754
734
755
735
756
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
0 commit comments