Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6b99a1

Browse files
committed
Move deprecated functions at the end of their respective sections.
1 parent 70d86bd commit e6b99a1

1 file changed

Lines changed: 122 additions & 122 deletions

File tree

Doc/c-api/unicode.rst

Lines changed: 122 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -81,46 +81,6 @@ access internal read-only data of Unicode objects:
8181
subtype.
8282
8383
84-
.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)
85-
86-
Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
87-
code units (this includes surrogate pairs as 2 units). *o* has to be a
88-
Unicode object (not checked).
89-
90-
.. deprecated-removed:: 3.3 4.0
91-
Part of the old-style Unicode API, please migrate to using
92-
:c:func:`PyUnicode_GET_LENGTH`.
93-
94-
95-
.. c:function:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o)
96-
97-
Return the size of the deprecated :c:type:`Py_UNICODE` representation in
98-
bytes. *o* has to be a Unicode object (not checked).
99-
100-
.. deprecated-removed:: 3.3 4.0
101-
Part of the old-style Unicode API, please migrate to using
102-
:c:func:`PyUnicode_GET_LENGTH`.
103-
104-
105-
.. c:function:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o)
106-
const char* PyUnicode_AS_DATA(PyObject *o)
107-
108-
Return a pointer to a :c:type:`Py_UNICODE` representation of the object. The
109-
``AS_DATA`` form casts the pointer to :c:type:`const char *`. *o* has to be
110-
a Unicode object (not checked).
111-
112-
.. versionchanged:: 3.3
113-
This macro is now inefficient -- because in many cases the
114-
:c:type:`Py_UNICODE` representation does not exist and needs to be created
115-
-- and can fail (return *NULL* with an exception set). Try to port the
116-
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
117-
:c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`.
118-
119-
.. deprecated-removed:: 3.3 4.0
120-
Part of the old-style Unicode API, please migrate to using the
121-
:c:func:`PyUnicode_nBYTE_DATA` family of macros.
122-
123-
12484
.. c:function:: int PyUnicode_READY(PyObject *o)
12585
12686
Ensure the string object *o* is in the "canonical" representation. This is
@@ -227,6 +187,46 @@ access internal read-only data of Unicode objects:
227187
Clear the free list. Return the total number of freed items.
228188
229189
190+
.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)
191+
192+
Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
193+
code units (this includes surrogate pairs as 2 units). *o* has to be a
194+
Unicode object (not checked).
195+
196+
.. deprecated-removed:: 3.3 4.0
197+
Part of the old-style Unicode API, please migrate to using
198+
:c:func:`PyUnicode_GET_LENGTH`.
199+
200+
201+
.. c:function:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o)
202+
203+
Return the size of the deprecated :c:type:`Py_UNICODE` representation in
204+
bytes. *o* has to be a Unicode object (not checked).
205+
206+
.. deprecated-removed:: 3.3 4.0
207+
Part of the old-style Unicode API, please migrate to using
208+
:c:func:`PyUnicode_GET_LENGTH`.
209+
210+
211+
.. c:function:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o)
212+
const char* PyUnicode_AS_DATA(PyObject *o)
213+
214+
Return a pointer to a :c:type:`Py_UNICODE` representation of the object. The
215+
``AS_DATA`` form casts the pointer to :c:type:`const char *`. *o* has to be
216+
a Unicode object (not checked).
217+
218+
.. versionchanged:: 3.3
219+
This macro is now inefficient -- because in many cases the
220+
:c:type:`Py_UNICODE` representation does not exist and needs to be created
221+
-- and can fail (return *NULL* with an exception set). Try to port the
222+
code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use
223+
:c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`.
224+
225+
.. deprecated-removed:: 3.3 4.0
226+
Part of the old-style Unicode API, please migrate to using the
227+
:c:func:`PyUnicode_nBYTE_DATA` family of macros.
228+
229+
230230
Unicode Character Properties
231231
""""""""""""""""""""""""""""
232232
@@ -856,6 +856,16 @@ These are the generic codec APIs:
856856
the codec.
857857
858858
859+
.. c:function:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, \
860+
const char *encoding, const char *errors)
861+
862+
Encode a Unicode object and return the result as Python bytes object.
863+
*encoding* and *errors* have the same meaning as the parameters of the same
864+
name in the Unicode :meth:`encode` method. The codec to be used is looked up
865+
using the Python codec registry. Return *NULL* if an exception was raised by
866+
the codec.
867+
868+
859869
.. c:function:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, \
860870
const char *encoding, const char *errors)
861871
@@ -870,16 +880,6 @@ These are the generic codec APIs:
870880
:c:func:`PyUnicode_AsEncodedString`.
871881
872882
873-
.. c:function:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, \
874-
const char *encoding, const char *errors)
875-
876-
Encode a Unicode object and return the result as Python bytes object.
877-
*encoding* and *errors* have the same meaning as the parameters of the same
878-
name in the Unicode :meth:`encode` method. The codec to be used is looked up
879-
using the Python codec registry. Return *NULL* if an exception was raised by
880-
the codec.
881-
882-
883883
UTF-8 Codecs
884884
""""""""""""
885885
@@ -901,17 +901,6 @@ These are the UTF-8 codec APIs:
901901
that have been decoded will be stored in *consumed*.
902902
903903
904-
.. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
905-
906-
Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and
907-
return a Python bytes object. Return *NULL* if an exception was raised by
908-
the codec.
909-
910-
.. deprecated-removed:: 3.3 4.0
911-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
912-
:c:func:`PyUnicode_AsUTF8String` or :c:func:`PyUnicode_AsUTF8AndSize`.
913-
914-
915904
.. c:function:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode)
916905
917906
Encode a Unicode object using UTF-8 and return the result as Python bytes
@@ -942,6 +931,17 @@ These are the UTF-8 codec APIs:
942931
.. versionadded:: 3.3
943932
944933
934+
.. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
935+
936+
Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and
937+
return a Python bytes object. Return *NULL* if an exception was raised by
938+
the codec.
939+
940+
.. deprecated-removed:: 3.3 4.0
941+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
942+
:c:func:`PyUnicode_AsUTF8String` or :c:func:`PyUnicode_AsUTF8AndSize`.
943+
944+
945945
UTF-32 Codecs
946946
"""""""""""""
947947
@@ -987,6 +987,13 @@ These are the UTF-32 codec APIs:
987987
that have been decoded will be stored in *consumed*.
988988
989989
990+
.. c:function:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
991+
992+
Return a Python byte string using the UTF-32 encoding in native byte
993+
order. The string always starts with a BOM mark. Error handling is "strict".
994+
Return *NULL* if an exception was raised by the codec.
995+
996+
990997
.. c:function:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, \
991998
const char *errors, int byteorder)
992999
@@ -1010,13 +1017,6 @@ These are the UTF-32 codec APIs:
10101017
:c:func:`PyUnicode_AsUTF32String`.
10111018
10121019
1013-
.. c:function:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
1014-
1015-
Return a Python byte string using the UTF-32 encoding in native byte
1016-
order. The string always starts with a BOM mark. Error handling is "strict".
1017-
Return *NULL* if an exception was raised by the codec.
1018-
1019-
10201020
UTF-16 Codecs
10211021
"""""""""""""
10221022
@@ -1061,6 +1061,13 @@ These are the UTF-16 codec APIs:
10611061
number of bytes that have been decoded will be stored in *consumed*.
10621062
10631063
1064+
.. c:function:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
1065+
1066+
Return a Python byte string using the UTF-16 encoding in native byte
1067+
order. The string always starts with a BOM mark. Error handling is "strict".
1068+
Return *NULL* if an exception was raised by the codec.
1069+
1070+
10641071
.. c:function:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, \
10651072
const char *errors, int byteorder)
10661073
@@ -1085,13 +1092,6 @@ These are the UTF-16 codec APIs:
10851092
:c:func:`PyUnicode_AsUTF16String`.
10861093
10871094
1088-
.. c:function:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
1089-
1090-
Return a Python byte string using the UTF-16 encoding in native byte
1091-
order. The string always starts with a BOM mark. Error handling is "strict".
1092-
Return *NULL* if an exception was raised by the codec.
1093-
1094-
10951095
UTF-7 Codecs
10961096
""""""""""""
10971097
@@ -1144,6 +1144,13 @@ These are the "Unicode Escape" codec APIs:
11441144
string *s*. Return *NULL* if an exception was raised by the codec.
11451145
11461146
1147+
.. c:function:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
1148+
1149+
Encode a Unicode object using Unicode-Escape and return the result as Python
1150+
string object. Error handling is "strict". Return *NULL* if an exception was
1151+
raised by the codec.
1152+
1153+
11471154
.. c:function:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size)
11481155
11491156
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and
@@ -1155,13 +1162,6 @@ These are the "Unicode Escape" codec APIs:
11551162
:c:func:`PyUnicode_AsUnicodeEscapeString`.
11561163
11571164
1158-
.. c:function:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
1159-
1160-
Encode a Unicode object using Unicode-Escape and return the result as Python
1161-
string object. Error handling is "strict". Return *NULL* if an exception was
1162-
raised by the codec.
1163-
1164-
11651165
Raw-Unicode-Escape Codecs
11661166
"""""""""""""""""""""""""
11671167
@@ -1175,6 +1175,13 @@ These are the "Raw Unicode Escape" codec APIs:
11751175
encoded string *s*. Return *NULL* if an exception was raised by the codec.
11761176
11771177
1178+
.. c:function:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
1179+
1180+
Encode a Unicode object using Raw-Unicode-Escape and return the result as
1181+
Python string object. Error handling is "strict". Return *NULL* if an exception
1182+
was raised by the codec.
1183+
1184+
11781185
.. c:function:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, \
11791186
Py_ssize_t size, const char *errors)
11801187
@@ -1187,13 +1194,6 @@ These are the "Raw Unicode Escape" codec APIs:
11871194
:c:func:`PyUnicode_AsRawUnicodeEscapeString`.
11881195
11891196
1190-
.. c:function:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
1191-
1192-
Encode a Unicode object using Raw-Unicode-Escape and return the result as
1193-
Python string object. Error handling is "strict". Return *NULL* if an exception
1194-
was raised by the codec.
1195-
1196-
11971197
Latin-1 Codecs
11981198
""""""""""""""
11991199
@@ -1207,6 +1207,13 @@ ordinals and only these are accepted by the codecs during encoding.
12071207
*s*. Return *NULL* if an exception was raised by the codec.
12081208
12091209
1210+
.. c:function:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
1211+
1212+
Encode a Unicode object using Latin-1 and return the result as Python bytes
1213+
object. Error handling is "strict". Return *NULL* if an exception was
1214+
raised by the codec.
1215+
1216+
12101217
.. c:function:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
12111218
12121219
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and
@@ -1218,13 +1225,6 @@ ordinals and only these are accepted by the codecs during encoding.
12181225
:c:func:`PyUnicode_AsLatin1String`.
12191226
12201227
1221-
.. c:function:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
1222-
1223-
Encode a Unicode object using Latin-1 and return the result as Python bytes
1224-
object. Error handling is "strict". Return *NULL* if an exception was
1225-
raised by the codec.
1226-
1227-
12281228
ASCII Codecs
12291229
""""""""""""
12301230
@@ -1238,6 +1238,13 @@ codes generate errors.
12381238
*s*. Return *NULL* if an exception was raised by the codec.
12391239
12401240
1241+
.. c:function:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
1242+
1243+
Encode a Unicode object using ASCII and return the result as Python bytes
1244+
object. Error handling is "strict". Return *NULL* if an exception was
1245+
raised by the codec.
1246+
1247+
12411248
.. c:function:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
12421249
12431250
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and
@@ -1249,13 +1256,6 @@ codes generate errors.
12491256
:c:func:`PyUnicode_AsASCIIString`.
12501257
12511258
1252-
.. c:function:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
1253-
1254-
Encode a Unicode object using ASCII and return the result as Python bytes
1255-
object. Error handling is "strict". Return *NULL* if an exception was
1256-
raised by the codec.
1257-
1258-
12591259
Character Map Codecs
12601260
""""""""""""""""""""
12611261
@@ -1293,18 +1293,6 @@ These are the mapping codec APIs:
12931293
treated as "undefined mapping".
12941294
12951295
1296-
.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \
1297-
PyObject *mapping, const char *errors)
1298-
1299-
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given
1300-
*mapping* object and return a Python string object. Return *NULL* if an
1301-
exception was raised by the codec.
1302-
1303-
.. deprecated-removed:: 3.3 4.0
1304-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1305-
:c:func:`PyUnicode_AsCharmapString`.
1306-
1307-
13081296
.. c:function:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping)
13091297
13101298
Encode a Unicode object using the given *mapping* object and return the result
@@ -1334,6 +1322,18 @@ The following codec API is special in that maps Unicode to Unicode.
13341322
.. XXX replace with what?
13351323
13361324
1325+
.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \
1326+
PyObject *mapping, const char *errors)
1327+
1328+
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given
1329+
*mapping* object and return a Python string object. Return *NULL* if an
1330+
exception was raised by the codec.
1331+
1332+
.. deprecated-removed:: 3.3 4.0
1333+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
1334+
:c:func:`PyUnicode_AsCharmapString`.
1335+
1336+
13371337
MBCS codecs for Windows
13381338
"""""""""""""""""""""""
13391339
@@ -1357,6 +1357,13 @@ the user settings on the machine running the codec.
13571357
in *consumed*.
13581358
13591359
1360+
.. c:function:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
1361+
1362+
Encode a Unicode object using MBCS and return the result as Python bytes
1363+
object. Error handling is "strict". Return *NULL* if an exception was
1364+
raised by the codec.
1365+
1366+
13601367
.. c:function:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
13611368
13621369
Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and return
@@ -1368,13 +1375,6 @@ the user settings on the machine running the codec.
13681375
:c:func:`PyUnicode_AsMBCSString`.
13691376
13701377
1371-
.. c:function:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
1372-
1373-
Encode a Unicode object using MBCS and return the result as Python bytes
1374-
object. Error handling is "strict". Return *NULL* if an exception was
1375-
raised by the codec.
1376-
1377-
13781378
Methods & Slots
13791379
"""""""""""""""
13801380

0 commit comments

Comments
 (0)