Skip to content

Commit 145d925

Browse files
[3.11] gh-107298: Fix references to deprecated and removed PyUnicode C API (GH-108077) (GH-108226)
(cherry picked from commit db55383) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 75617ac commit 145d925

File tree

5 files changed

+54
-54
lines changed

5 files changed

+54
-54
lines changed

Doc/whatsnew/3.11.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -2591,30 +2591,30 @@ Pending Removal in Python 3.12
25912591
The following C APIs have been deprecated in earlier Python releases,
25922592
and will be removed in Python 3.12.
25932593

2594-
* :c:func:`PyUnicode_AS_DATA`
2595-
* :c:func:`PyUnicode_AS_UNICODE`
2596-
* :c:func:`PyUnicode_AsUnicodeAndSize`
2597-
* :c:func:`PyUnicode_AsUnicode`
2598-
* :c:func:`PyUnicode_FromUnicode`
2599-
* :c:func:`PyUnicode_GET_DATA_SIZE`
2600-
* :c:func:`PyUnicode_GET_SIZE`
2601-
* :c:func:`PyUnicode_GetSize`
2594+
* :c:func:`!PyUnicode_AS_DATA`
2595+
* :c:func:`!PyUnicode_AS_UNICODE`
2596+
* :c:func:`!PyUnicode_AsUnicodeAndSize`
2597+
* :c:func:`!PyUnicode_AsUnicode`
2598+
* :c:func:`!PyUnicode_FromUnicode`
2599+
* :c:func:`!PyUnicode_GET_DATA_SIZE`
2600+
* :c:func:`!PyUnicode_GET_SIZE`
2601+
* :c:func:`!PyUnicode_GetSize`
26022602
* :c:func:`PyUnicode_IS_COMPACT`
26032603
* :c:func:`PyUnicode_IS_READY`
26042604
* :c:func:`PyUnicode_READY`
2605-
* :c:func:`Py_UNICODE_WSTR_LENGTH`
2606-
* :c:func:`_PyUnicode_AsUnicode`
2607-
* :c:macro:`PyUnicode_WCHAR_KIND`
2605+
* :c:func:`!PyUnicode_WSTR_LENGTH`
2606+
* :c:func:`!_PyUnicode_AsUnicode`
2607+
* :c:macro:`!PyUnicode_WCHAR_KIND`
26082608
* :c:type:`PyUnicodeObject`
2609-
* :c:func:`PyUnicode_InternImmortal()`
2609+
* :c:func:`!PyUnicode_InternImmortal`
26102610

26112611

26122612
.. _whatsnew311-c-api-removed:
26132613

26142614
Removed
26152615
-------
26162616

2617-
* :c:func:`PyFrame_BlockSetup` and :c:func:`PyFrame_BlockPop` have been
2617+
* :c:func:`!PyFrame_BlockSetup` and :c:func:`!PyFrame_BlockPop` have been
26182618
removed.
26192619
(Contributed by Mark Shannon in :issue:`40222`.)
26202620

Doc/whatsnew/3.3.rst

+33-33
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Changes introduced by :pep:`393` are the following:
249249
non-BMP code points.
250250

251251
* The value of :data:`sys.maxunicode` is now always ``1114111`` (``0x10FFFF``
252-
in hexadecimal). The :c:func:`PyUnicode_GetMax` function still returns
252+
in hexadecimal). The :c:func:`!PyUnicode_GetMax` function still returns
253253
either ``0xFFFF`` or ``0x10FFFF`` for backward compatibility, and it should
254254
not be used with the new Unicode API (see :issue:`13054`).
255255

@@ -2195,7 +2195,7 @@ Changes to Python's build process and to the C API include:
21952195
* :c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`,
21962196
:c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`
21972197
* :c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum:
2198-
:c:data:`PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`,
2198+
:c:data:`!PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`,
21992199
:c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`
22002200
* :c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`
22012201
* :c:macro:`PyUnicode_MAX_CHAR_VALUE`
@@ -2269,58 +2269,58 @@ removed in Python 4. All functions using this type are deprecated:
22692269
Unicode functions and methods using :c:type:`Py_UNICODE` and
22702270
:c:expr:`Py_UNICODE*` types:
22712271

2272-
* :c:macro:`PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or
2272+
* :c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or
22732273
:c:func:`PyUnicode_FromKindAndData`
2274-
* :c:macro:`PyUnicode_AS_UNICODE`, :c:func:`PyUnicode_AsUnicode`,
2275-
:c:func:`PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`
2276-
* :c:macro:`PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with
2274+
* :c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`,
2275+
:c:func:`!PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`
2276+
* :c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with
22772277
:c:macro:`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`
2278-
* :c:macro:`PyUnicode_GET_SIZE`, :c:func:`PyUnicode_GetSize`: use
2278+
* :c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use
22792279
:c:macro:`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`
2280-
* :c:macro:`PyUnicode_GET_DATA_SIZE`: use
2280+
* :c:macro:`!PyUnicode_GET_DATA_SIZE`: use
22812281
``PyUnicode_GET_LENGTH(str) * PyUnicode_KIND(str)`` (only work on ready
22822282
strings)
2283-
* :c:func:`PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or
2283+
* :c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or
22842284
:c:func:`PyUnicode_AsWideCharString`
2285-
* :c:func:`PyUnicode_GetMax`
2285+
* :c:func:`!PyUnicode_GetMax`
22862286

22872287

22882288
Functions and macros manipulating Py_UNICODE* strings:
22892289

2290-
* :c:macro:`Py_UNICODE_strlen`: use :c:func:`PyUnicode_GetLength` or
2290+
* :c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or
22912291
:c:macro:`PyUnicode_GET_LENGTH`
2292-
* :c:macro:`Py_UNICODE_strcat`: use :c:func:`PyUnicode_CopyCharacters` or
2292+
* :c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or
22932293
:c:func:`PyUnicode_FromFormat`
2294-
* :c:macro:`Py_UNICODE_strcpy`, :c:macro:`Py_UNICODE_strncpy`,
2295-
:c:macro:`Py_UNICODE_COPY`: use :c:func:`PyUnicode_CopyCharacters` or
2294+
* :c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`,
2295+
:c:macro:`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or
22962296
:c:func:`PyUnicode_Substring`
2297-
* :c:macro:`Py_UNICODE_strcmp`: use :c:func:`PyUnicode_Compare`
2298-
* :c:macro:`Py_UNICODE_strncmp`: use :c:func:`PyUnicode_Tailmatch`
2299-
* :c:macro:`Py_UNICODE_strchr`, :c:macro:`Py_UNICODE_strrchr`: use
2297+
* :c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`
2298+
* :c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`
2299+
* :c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use
23002300
:c:func:`PyUnicode_FindChar`
2301-
* :c:macro:`Py_UNICODE_FILL`: use :c:func:`PyUnicode_Fill`
2302-
* :c:macro:`Py_UNICODE_MATCH`
2301+
* :c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`
2302+
* :c:macro:`!Py_UNICODE_MATCH`
23032303

23042304
Encoders:
23052305

2306-
* :c:func:`PyUnicode_Encode`: use :c:func:`PyUnicode_AsEncodedObject`
2307-
* :c:func:`PyUnicode_EncodeUTF7`
2308-
* :c:func:`PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or
2306+
* :c:func:`!PyUnicode_Encode`: use :c:func:`PyUnicode_AsEncodedObject`
2307+
* :c:func:`!PyUnicode_EncodeUTF7`
2308+
* :c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or
23092309
:c:func:`PyUnicode_AsUTF8String`
2310-
* :c:func:`PyUnicode_EncodeUTF32`
2311-
* :c:func:`PyUnicode_EncodeUTF16`
2312-
* :c:func:`PyUnicode_EncodeUnicodeEscape` use
2310+
* :c:func:`!PyUnicode_EncodeUTF32`
2311+
* :c:func:`!PyUnicode_EncodeUTF16`
2312+
* :c:func:`!PyUnicode_EncodeUnicodeEscape` use
23132313
:c:func:`PyUnicode_AsUnicodeEscapeString`
2314-
* :c:func:`PyUnicode_EncodeRawUnicodeEscape` use
2314+
* :c:func:`!PyUnicode_EncodeRawUnicodeEscape` use
23152315
:c:func:`PyUnicode_AsRawUnicodeEscapeString`
2316-
* :c:func:`PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`
2317-
* :c:func:`PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`
2318-
* :c:func:`PyUnicode_EncodeCharmap`
2319-
* :c:func:`PyUnicode_TranslateCharmap`
2320-
* :c:func:`PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or
2316+
* :c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`
2317+
* :c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`
2318+
* :c:func:`!PyUnicode_EncodeCharmap`
2319+
* :c:func:`!PyUnicode_TranslateCharmap`
2320+
* :c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or
23212321
:c:func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)
2322-
* :c:func:`PyUnicode_EncodeDecimal`,
2323-
:c:func:`PyUnicode_TransformDecimalToASCII`
2322+
* :c:func:`!PyUnicode_EncodeDecimal`,
2323+
:c:func:`!PyUnicode_TransformDecimalToASCII`
23242324

23252325

23262326
Deprecated features

Doc/whatsnew/3.6.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2066,9 +2066,9 @@ environment. (Contributed by Brett Cannon in :issue:`25154`.)
20662066
Deprecated functions and types of the C API
20672067
-------------------------------------------
20682068

2069-
Undocumented functions :c:func:`PyUnicode_AsEncodedObject`,
2070-
:c:func:`PyUnicode_AsDecodedObject`, :c:func:`PyUnicode_AsEncodedUnicode`
2071-
and :c:func:`PyUnicode_AsDecodedUnicode` are deprecated now.
2069+
Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`,
2070+
:c:func:`!PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode`
2071+
and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now.
20722072
Use the :ref:`generic codec based API <codec-registry>` instead.
20732073

20742074

Doc/whatsnew/3.9.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,8 @@ Porting to Python 3.9
13701370
(Contributed by Victor Stinner in :issue:`40241`.)
13711371

13721372
* The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``,
1373-
:c:func:`PyUnicode_FromUnicode`, :c:func:`PyUnicode_AsUnicode`,
1374-
``_PyUnicode_AsUnicode``, and :c:func:`PyUnicode_AsUnicodeAndSize` are
1373+
:c:func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`,
1374+
``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are
13751375
marked as deprecated in C. They have been deprecated by :pep:`393` since
13761376
Python 3.3.
13771377
(Contributed by Inada Naoki in :issue:`36346`.)

Misc/NEWS.d/3.11.0b1.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2068,9 +2068,9 @@ casts when the Python C API is used in C++. Patch by Victor Stinner.
20682068
.. nonce: Cx-95G
20692069
.. section: C API
20702070
2071-
Mark functions as deprecated by :pep:`623`: :c:func:`PyUnicode_AS_DATA`,
2072-
:c:func:`PyUnicode_AS_UNICODE`, :c:func:`PyUnicode_GET_DATA_SIZE`,
2073-
:c:func:`PyUnicode_GET_SIZE`. Patch by Victor Stinner.
2071+
Mark functions as deprecated by :pep:`623`: :c:func:`!PyUnicode_AS_DATA`,
2072+
:c:func:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_GET_DATA_SIZE`,
2073+
:c:func:`!PyUnicode_GET_SIZE`. Patch by Victor Stinner.
20742074

20752075
..
20762076

0 commit comments

Comments
 (0)