X Tutup
Skip to content

Commit 6107f46

Browse files
Issue python#19569: Suggested more appropriate replacements for deprecated Unicode
C API functions.
2 parents 85b0f5b + 92b9a1f commit 6107f46

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

Doc/c-api/unicode.rst

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@ Extension modules can continue using them, as they will not be removed in Python
679679
string content has been filled before using any of the access macros such as
680680
:c:func:`PyUnicode_KIND`.
681681
682-
Please migrate to using :c:func:`PyUnicode_FromKindAndData` or
683-
:c:func:`PyUnicode_New`.
682+
Please migrate to using :c:func:`PyUnicode_FromKindAndData`,
683+
:c:func:`PyUnicode_FromWideChar` or :c:func:`PyUnicode_New`.
684684
685685
686686
.. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
@@ -694,7 +694,7 @@ Extension modules can continue using them, as they will not be removed in Python
694694
used in most C functions.
695695
696696
Please migrate to using :c:func:`PyUnicode_AsUCS4`,
697-
:c:func:`PyUnicode_Substring`, :c:func:`PyUnicode_ReadChar` or similar new
697+
:c:func:`PyUnicode_AsWideChar`, :c:func:`PyUnicode_ReadChar` or similar new
698698
APIs.
699699
700700
@@ -1091,7 +1091,8 @@ These are the UTF-8 codec APIs:
10911091
10921092
.. deprecated-removed:: 3.3 4.0
10931093
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1094-
:c:func:`PyUnicode_AsUTF8String` or :c:func:`PyUnicode_AsUTF8AndSize`.
1094+
:c:func:`PyUnicode_AsUTF8String`, :c:func:`PyUnicode_AsUTF8AndSize` or
1095+
:c:func:`PyUnicode_AsEncodedString`.
10951096
10961097
10971098
UTF-32 Codecs
@@ -1164,7 +1165,7 @@ These are the UTF-32 codec APIs:
11641165
11651166
.. deprecated-removed:: 3.3 4.0
11661167
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1167-
:c:func:`PyUnicode_AsUTF32String`.
1168+
:c:func:`PyUnicode_AsUTF32String` or :c:func:`PyUnicode_AsEncodedString`.
11681169
11691170
11701171
UTF-16 Codecs
@@ -1239,7 +1240,7 @@ These are the UTF-16 codec APIs:
12391240
12401241
.. deprecated-removed:: 3.3 4.0
12411242
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1242-
:c:func:`PyUnicode_AsUTF16String`.
1243+
:c:func:`PyUnicode_AsUTF16String` or :c:func:`PyUnicode_AsEncodedString`.
12431244
12441245
12451246
UTF-7 Codecs
@@ -1276,9 +1277,8 @@ These are the UTF-7 codec APIs:
12761277
Python "utf-7" codec.
12771278
12781279
.. deprecated-removed:: 3.3 4.0
1279-
Part of the old-style :c:type:`Py_UNICODE` API.
1280-
1281-
.. XXX replace with what?
1280+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1281+
:c:func:`PyUnicode_AsEncodedString`.
12821282
12831283
12841284
Unicode-Escape Codecs
@@ -1341,7 +1341,8 @@ These are the "Raw Unicode Escape" codec APIs:
13411341
13421342
.. deprecated-removed:: 3.3 4.0
13431343
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1344-
:c:func:`PyUnicode_AsRawUnicodeEscapeString`.
1344+
:c:func:`PyUnicode_AsRawUnicodeEscapeString` or
1345+
:c:func:`PyUnicode_AsEncodedString`.
13451346
13461347
13471348
Latin-1 Codecs
@@ -1372,7 +1373,8 @@ ordinals and only these are accepted by the codecs during encoding.
13721373
13731374
.. deprecated-removed:: 3.3 4.0
13741375
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1375-
:c:func:`PyUnicode_AsLatin1String`.
1376+
:c:func:`PyUnicode_AsLatin1String` or
1377+
:c:func:`PyUnicode_AsEncodedString`.
13761378
13771379
13781380
ASCII Codecs
@@ -1403,7 +1405,8 @@ codes generate errors.
14031405
14041406
.. deprecated-removed:: 3.3 4.0
14051407
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1406-
:c:func:`PyUnicode_AsASCIIString`.
1408+
:c:func:`PyUnicode_AsASCIIString` or
1409+
:c:func:`PyUnicode_AsEncodedString`.
14071410
14081411
14091412
Character Map Codecs
@@ -1467,9 +1470,9 @@ The following codec API is special in that maps Unicode to Unicode.
14671470
:exc:`LookupError`) are left untouched and are copied as-is.
14681471
14691472
.. deprecated-removed:: 3.3 4.0
1470-
Part of the old-style :c:type:`Py_UNICODE` API.
1471-
1472-
.. XXX replace with what?
1473+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1474+
:c:func:`PyUnicode_Translate`. or :ref:`generic codec based API
1475+
<codec-registry>`
14731476
14741477
14751478
.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \
@@ -1481,7 +1484,8 @@ The following codec API is special in that maps Unicode to Unicode.
14811484
14821485
.. deprecated-removed:: 3.3 4.0
14831486
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1484-
:c:func:`PyUnicode_AsCharmapString`.
1487+
:c:func:`PyUnicode_AsCharmapString` or
1488+
:c:func:`PyUnicode_AsEncodedString`.
14851489
14861490
14871491
MBCS codecs for Windows
@@ -1531,7 +1535,8 @@ the user settings on the machine running the codec.
15311535
15321536
.. deprecated-removed:: 3.3 4.0
15331537
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1534-
:c:func:`PyUnicode_AsMBCSString` or :c:func:`PyUnicode_EncodeCodePage`.
1538+
:c:func:`PyUnicode_AsMBCSString`, :c:func:`PyUnicode_EncodeCodePage` or
1539+
:c:func:`PyUnicode_AsEncodedString`.
15351540
15361541
15371542
Methods & Slots

0 commit comments

Comments
 (0)
X Tutup