Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/c-api/unicode.rst

    r2 r391  
    1212
    1313
     14Unicode Type
     15""""""""""""
     16
    1417These are the basic Unicode object types used for the Unicode implementation in
    1518Python:
    1619
    17 .. % --- Unicode Type -------------------------------------------------------
    18 
    19 
    20 .. ctype:: Py_UNICODE
     20
     21.. c:type:: Py_UNICODE
    2122
    2223   This type represents the storage type which is used by Python internally as
    2324   basis for holding Unicode ordinals.  Python's default builds use a 16-bit type
    24    for :ctype:`Py_UNICODE` and store Unicode values internally as UCS2. It is also
     25   for :c:type:`Py_UNICODE` and store Unicode values internally as UCS2. It is also
    2526   possible to build a UCS4 version of Python (most recent Linux distributions come
    2627   with UCS4 builds of Python). These builds then use a 32-bit type for
    27    :ctype:`Py_UNICODE` and store Unicode data internally as UCS4. On platforms
    28    where :ctype:`wchar_t` is available and compatible with the chosen Python
    29    Unicode build variant, :ctype:`Py_UNICODE` is a typedef alias for
    30    :ctype:`wchar_t` to enhance native platform compatibility. On all other
    31    platforms, :ctype:`Py_UNICODE` is a typedef alias for either :ctype:`unsigned
    32    short` (UCS2) or :ctype:`unsigned long` (UCS4).
     28   :c:type:`Py_UNICODE` and store Unicode data internally as UCS4. On platforms
     29   where :c:type:`wchar_t` is available and compatible with the chosen Python
     30   Unicode build variant, :c:type:`Py_UNICODE` is a typedef alias for
     31   :c:type:`wchar_t` to enhance native platform compatibility. On all other
     32   platforms, :c:type:`Py_UNICODE` is a typedef alias for either :c:type:`unsigned
     33   short` (UCS2) or :c:type:`unsigned long` (UCS4).
    3334
    3435Note that UCS2 and UCS4 Python builds are not binary compatible. Please keep
     
    3637
    3738
    38 .. ctype:: PyUnicodeObject
    39 
    40    This subtype of :ctype:`PyObject` represents a Python Unicode object.
    41 
    42 
    43 .. cvar:: PyTypeObject PyUnicode_Type
    44 
    45    This instance of :ctype:`PyTypeObject` represents the Python Unicode type.  It
     39.. c:type:: PyUnicodeObject
     40
     41   This subtype of :c:type:`PyObject` represents a Python Unicode object.
     42
     43
     44.. c:var:: PyTypeObject PyUnicode_Type
     45
     46   This instance of :c:type:`PyTypeObject` represents the Python Unicode type.  It
    4647   is exposed to Python code as ``unicode`` and ``types.UnicodeType``.
    4748
     
    5051
    5152
    52 .. cfunction:: int PyUnicode_Check(PyObject *o)
     53.. c:function:: int PyUnicode_Check(PyObject *o)
    5354
    5455   Return true if the object *o* is a Unicode object or an instance of a Unicode
     
    5960
    6061
    61 .. cfunction:: int PyUnicode_CheckExact(PyObject *o)
     62.. c:function:: int PyUnicode_CheckExact(PyObject *o)
    6263
    6364   Return true if the object *o* is a Unicode object, but not an instance of a
     
    6768
    6869
    69 .. cfunction:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)
    70 
    71    Return the size of the object.  *o* has to be a :ctype:`PyUnicodeObject` (not
     70.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)
     71
     72   Return the size of the object.  *o* has to be a :c:type:`PyUnicodeObject` (not
    7273   checked).
    7374
    7475   .. versionchanged:: 2.5
    75       This function returned an :ctype:`int` type. This might require changes
     76      This function returned an :c:type:`int` type. This might require changes
    7677      in your code for properly supporting 64-bit systems.
    7778
    7879
    79 .. cfunction:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o)
     80.. c:function:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o)
    8081
    8182   Return the size of the object's internal buffer in bytes.  *o* has to be a
    82    :ctype:`PyUnicodeObject` (not checked).
    83 
    84    .. versionchanged:: 2.5
    85       This function returned an :ctype:`int` type. This might require changes
     83   :c:type:`PyUnicodeObject` (not checked).
     84
     85   .. versionchanged:: 2.5
     86      This function returned an :c:type:`int` type. This might require changes
    8687      in your code for properly supporting 64-bit systems.
    8788
    8889
    89 .. cfunction:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o)
    90 
    91    Return a pointer to the internal :ctype:`Py_UNICODE` buffer of the object.  *o*
    92    has to be a :ctype:`PyUnicodeObject` (not checked).
    93 
    94 
    95 .. cfunction:: const char* PyUnicode_AS_DATA(PyObject *o)
     90.. c:function:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o)
     91
     92   Return a pointer to the internal :c:type:`Py_UNICODE` buffer of the object.  *o*
     93   has to be a :c:type:`PyUnicodeObject` (not checked).
     94
     95
     96.. c:function:: const char* PyUnicode_AS_DATA(PyObject *o)
    9697
    9798   Return a pointer to the internal buffer of the object. *o* has to be a
    98    :ctype:`PyUnicodeObject` (not checked).
    99 
    100 
    101 .. cfunction:: int PyUnicode_ClearFreeList()
     99   :c:type:`PyUnicodeObject` (not checked).
     100
     101
     102.. c:function:: int PyUnicode_ClearFreeList()
    102103
    103104   Clear the free list. Return the total number of freed items.
     
    105106   .. versionadded:: 2.6
    106107
     108
     109Unicode Character Properties
     110""""""""""""""""""""""""""""
    107111
    108112Unicode provides many different character properties. The most often needed ones
     
    110114the Python configuration.
    111115
    112 .. % --- Unicode character properties ---------------------------------------
    113 
    114 
    115 .. cfunction:: int Py_UNICODE_ISSPACE(Py_UNICODE ch)
     116
     117.. c:function:: int Py_UNICODE_ISSPACE(Py_UNICODE ch)
    116118
    117119   Return 1 or 0 depending on whether *ch* is a whitespace character.
    118120
    119121
    120 .. cfunction:: int Py_UNICODE_ISLOWER(Py_UNICODE ch)
     122.. c:function:: int Py_UNICODE_ISLOWER(Py_UNICODE ch)
    121123
    122124   Return 1 or 0 depending on whether *ch* is a lowercase character.
    123125
    124126
    125 .. cfunction:: int Py_UNICODE_ISUPPER(Py_UNICODE ch)
     127.. c:function:: int Py_UNICODE_ISUPPER(Py_UNICODE ch)
    126128
    127129   Return 1 or 0 depending on whether *ch* is an uppercase character.
    128130
    129131
    130 .. cfunction:: int Py_UNICODE_ISTITLE(Py_UNICODE ch)
     132.. c:function:: int Py_UNICODE_ISTITLE(Py_UNICODE ch)
    131133
    132134   Return 1 or 0 depending on whether *ch* is a titlecase character.
    133135
    134136
    135 .. cfunction:: int Py_UNICODE_ISLINEBREAK(Py_UNICODE ch)
     137.. c:function:: int Py_UNICODE_ISLINEBREAK(Py_UNICODE ch)
    136138
    137139   Return 1 or 0 depending on whether *ch* is a linebreak character.
    138140
    139141
    140 .. cfunction:: int Py_UNICODE_ISDECIMAL(Py_UNICODE ch)
     142.. c:function:: int Py_UNICODE_ISDECIMAL(Py_UNICODE ch)
    141143
    142144   Return 1 or 0 depending on whether *ch* is a decimal character.
    143145
    144146
    145 .. cfunction:: int Py_UNICODE_ISDIGIT(Py_UNICODE ch)
     147.. c:function:: int Py_UNICODE_ISDIGIT(Py_UNICODE ch)
    146148
    147149   Return 1 or 0 depending on whether *ch* is a digit character.
    148150
    149151
    150 .. cfunction:: int Py_UNICODE_ISNUMERIC(Py_UNICODE ch)
     152.. c:function:: int Py_UNICODE_ISNUMERIC(Py_UNICODE ch)
    151153
    152154   Return 1 or 0 depending on whether *ch* is a numeric character.
    153155
    154156
    155 .. cfunction:: int Py_UNICODE_ISALPHA(Py_UNICODE ch)
     157.. c:function:: int Py_UNICODE_ISALPHA(Py_UNICODE ch)
    156158
    157159   Return 1 or 0 depending on whether *ch* is an alphabetic character.
    158160
    159161
    160 .. cfunction:: int Py_UNICODE_ISALNUM(Py_UNICODE ch)
     162.. c:function:: int Py_UNICODE_ISALNUM(Py_UNICODE ch)
    161163
    162164   Return 1 or 0 depending on whether *ch* is an alphanumeric character.
     
    165167
    166168
    167 .. cfunction:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch)
     169.. c:function:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch)
    168170
    169171   Return the character *ch* converted to lower case.
    170172
    171173
    172 .. cfunction:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch)
     174.. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch)
    173175
    174176   Return the character *ch* converted to upper case.
    175177
    176178
    177 .. cfunction:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch)
     179.. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch)
    178180
    179181   Return the character *ch* converted to title case.
    180182
    181183
    182 .. cfunction:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch)
     184.. c:function:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch)
    183185
    184186   Return the character *ch* converted to a decimal positive integer.  Return
     
    186188
    187189
    188 .. cfunction:: int Py_UNICODE_TODIGIT(Py_UNICODE ch)
     190.. c:function:: int Py_UNICODE_TODIGIT(Py_UNICODE ch)
    189191
    190192   Return the character *ch* converted to a single digit integer. Return ``-1`` if
     
    192194
    193195
    194 .. cfunction:: double Py_UNICODE_TONUMERIC(Py_UNICODE ch)
     196.. c:function:: double Py_UNICODE_TONUMERIC(Py_UNICODE ch)
    195197
    196198   Return the character *ch* converted to a double. Return ``-1.0`` if this is not
    197199   possible.  This macro does not raise exceptions.
    198200
     201
     202Plain Py_UNICODE
     203""""""""""""""""
     204
    199205To create Unicode objects and access their basic sequence properties, use these
    200206APIs:
    201207
    202 .. % --- Plain Py_UNICODE ---------------------------------------------------
    203 
    204 
    205 .. cfunction:: PyObject* PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
    206 
    207    Create a Unicode Object from the Py_UNICODE buffer *u* of the given size. *u*
     208
     209.. c:function:: PyObject* PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
     210
     211   Create a Unicode object from the Py_UNICODE buffer *u* of the given size. *u*
    208212   may be *NULL* which causes the contents to be undefined. It is the user's
    209213   responsibility to fill in the needed data.  The buffer is copied into the new
     
    213217
    214218   .. versionchanged:: 2.5
    215       This function used an :ctype:`int` type for *size*. This might require
    216       changes in your code for properly supporting 64-bit systems.
    217 
    218 
    219 .. cfunction:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
    220 
    221    Return a read-only pointer to the Unicode object's internal :ctype:`Py_UNICODE`
    222    buffer, *NULL* if *unicode* is not a Unicode object.
    223 
    224 
    225 .. cfunction:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
     219      This function used an :c:type:`int` type for *size*. This might require
     220      changes in your code for properly supporting 64-bit systems.
     221
     222
     223.. c:function:: PyObject* PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
     224
     225   Create a Unicode object from the char buffer *u*.  The bytes will be interpreted
     226   as being UTF-8 encoded.  *u* may also be *NULL* which
     227   causes the contents to be undefined. It is the user's responsibility to fill in
     228   the needed data.  The buffer is copied into the new object. If the buffer is not
     229   *NULL*, the return value might be a shared object. Therefore, modification of
     230   the resulting Unicode object is only allowed when *u* is *NULL*.
     231
     232   .. versionadded:: 2.6
     233
     234
     235.. c:function:: PyObject *PyUnicode_FromString(const char *u)
     236
     237   Create a Unicode object from an UTF-8 encoded null-terminated char buffer
     238   *u*.
     239
     240   .. versionadded:: 2.6
     241
     242
     243.. c:function:: PyObject* PyUnicode_FromFormat(const char *format, ...)
     244
     245   Take a C :c:func:`printf`\ -style *format* string and a variable number of
     246   arguments, calculate the size of the resulting Python unicode string and return
     247   a string with the values formatted into it.  The variable arguments must be C
     248   types and must correspond exactly to the format characters in the *format*
     249   string.  The following format characters are allowed:
     250
     251   .. % The descriptions for %zd and %zu are wrong, but the truth is complicated
     252   .. % because not all compilers support the %z width modifier -- we fake it
     253   .. % when necessary via interpolating PY_FORMAT_SIZE_T.
     254
     255   .. tabularcolumns:: |l|l|L|
     256
     257   +-------------------+---------------------+--------------------------------+
     258   | Format Characters | Type                | Comment                        |
     259   +===================+=====================+================================+
     260   | :attr:`%%`        | *n/a*               | The literal % character.       |
     261   +-------------------+---------------------+--------------------------------+
     262   | :attr:`%c`        | int                 | A single character,            |
     263   |                   |                     | represented as an C int.       |
     264   +-------------------+---------------------+--------------------------------+
     265   | :attr:`%d`        | int                 | Exactly equivalent to          |
     266   |                   |                     | ``printf("%d")``.              |
     267   +-------------------+---------------------+--------------------------------+
     268   | :attr:`%u`        | unsigned int        | Exactly equivalent to          |
     269   |                   |                     | ``printf("%u")``.              |
     270   +-------------------+---------------------+--------------------------------+
     271   | :attr:`%ld`       | long                | Exactly equivalent to          |
     272   |                   |                     | ``printf("%ld")``.             |
     273   +-------------------+---------------------+--------------------------------+
     274   | :attr:`%lu`       | unsigned long       | Exactly equivalent to          |
     275   |                   |                     | ``printf("%lu")``.             |
     276   +-------------------+---------------------+--------------------------------+
     277   | :attr:`%zd`       | Py_ssize_t          | Exactly equivalent to          |
     278   |                   |                     | ``printf("%zd")``.             |
     279   +-------------------+---------------------+--------------------------------+
     280   | :attr:`%zu`       | size_t              | Exactly equivalent to          |
     281   |                   |                     | ``printf("%zu")``.             |
     282   +-------------------+---------------------+--------------------------------+
     283   | :attr:`%i`        | int                 | Exactly equivalent to          |
     284   |                   |                     | ``printf("%i")``.              |
     285   +-------------------+---------------------+--------------------------------+
     286   | :attr:`%x`        | int                 | Exactly equivalent to          |
     287   |                   |                     | ``printf("%x")``.              |
     288   +-------------------+---------------------+--------------------------------+
     289   | :attr:`%s`        | char\*              | A null-terminated C character  |
     290   |                   |                     | array.                         |
     291   +-------------------+---------------------+--------------------------------+
     292   | :attr:`%p`        | void\*              | The hex representation of a C  |
     293   |                   |                     | pointer. Mostly equivalent to  |
     294   |                   |                     | ``printf("%p")`` except that   |
     295   |                   |                     | it is guaranteed to start with |
     296   |                   |                     | the literal ``0x`` regardless  |
     297   |                   |                     | of what the platform's         |
     298   |                   |                     | ``printf`` yields.             |
     299   +-------------------+---------------------+--------------------------------+
     300   | :attr:`%U`        | PyObject\*          | A unicode object.              |
     301   +-------------------+---------------------+--------------------------------+
     302   | :attr:`%V`        | PyObject\*, char \* | A unicode object (which may be |
     303   |                   |                     | *NULL*) and a null-terminated  |
     304   |                   |                     | C character array as a second  |
     305   |                   |                     | parameter (which will be used, |
     306   |                   |                     | if the first parameter is      |
     307   |                   |                     | *NULL*).                       |
     308   +-------------------+---------------------+--------------------------------+
     309   | :attr:`%S`        | PyObject\*          | The result of calling          |
     310   |                   |                     | :func:`PyObject_Unicode`.      |
     311   +-------------------+---------------------+--------------------------------+
     312   | :attr:`%R`        | PyObject\*          | The result of calling          |
     313   |                   |                     | :func:`PyObject_Repr`.         |
     314   +-------------------+---------------------+--------------------------------+
     315
     316   An unrecognized format character causes all the rest of the format string to be
     317   copied as-is to the result string, and any extra arguments discarded.
     318
     319   .. versionadded:: 2.6
     320
     321
     322.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
     323
     324   Identical to :func:`PyUnicode_FromFormat` except that it takes exactly two
     325   arguments.
     326
     327   .. versionadded:: 2.6
     328
     329
     330.. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
     331
     332   Return a read-only pointer to the Unicode object's internal
     333   :c:type:`Py_UNICODE` buffer, *NULL* if *unicode* is not a Unicode object.
     334   Note that the resulting :c:type:`Py_UNICODE*` string may contain embedded
     335   null characters, which would cause the string to be truncated when used in
     336   most C functions.
     337
     338
     339.. c:function:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
    226340
    227341   Return the length of the Unicode object.
    228342
    229343   .. versionchanged:: 2.5
    230       This function returned an :ctype:`int` type. This might require changes
     344      This function returned an :c:type:`int` type. This might require changes
    231345      in your code for properly supporting 64-bit systems.
    232346
    233347
    234 .. cfunction:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors)
     348.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors)
    235349
    236350   Coerce an encoded object *obj* to an Unicode object and return a reference with
     
    249363
    250364
    251 .. cfunction:: PyObject* PyUnicode_FromObject(PyObject *obj)
     365.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
    252366
    253367   Shortcut for ``PyUnicode_FromEncodedObject(obj, NULL, "strict")`` which is used
    254368   throughout the interpreter whenever coercion to Unicode is needed.
    255369
    256 If the platform supports :ctype:`wchar_t` and provides a header file wchar.h,
     370If the platform supports :c:type:`wchar_t` and provides a header file wchar.h,
    257371Python can interface directly to this type using the following functions.
    258 Support is optimized if Python's own :ctype:`Py_UNICODE` type is identical to
    259 the system's :ctype:`wchar_t`.
    260 
    261 .. % --- wchar_t support for platforms which support it ---------------------
    262 
    263 
    264 .. cfunction:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
    265 
    266    Create a Unicode object from the :ctype:`wchar_t` buffer *w* of the given size.
     372Support is optimized if Python's own :c:type:`Py_UNICODE` type is identical to
     373the system's :c:type:`wchar_t`.
     374
     375
     376wchar_t Support
     377"""""""""""""""
     378
     379:c:type:`wchar_t` support for platforms which support it:
     380
     381.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
     382
     383   Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
    267384   Return *NULL* on failure.
    268385
    269386   .. versionchanged:: 2.5
    270       This function used an :ctype:`int` type for *size*. This might require
    271       changes in your code for properly supporting 64-bit systems.
    272 
    273 
    274 .. cfunction:: Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, wchar_t *w, Py_ssize_t size)
    275 
    276    Copy the Unicode object contents into the :ctype:`wchar_t` buffer *w*.  At most
    277    *size* :ctype:`wchar_t` characters are copied (excluding a possibly trailing
    278    0-termination character).  Return the number of :ctype:`wchar_t` characters
    279    copied or -1 in case of an error.  Note that the resulting :ctype:`wchar_t`
     387      This function used an :c:type:`int` type for *size*. This might require
     388      changes in your code for properly supporting 64-bit systems.
     389
     390
     391.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, wchar_t *w, Py_ssize_t size)
     392
     393   Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*.  At most
     394   *size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
     395   0-termination character).  Return the number of :c:type:`wchar_t` characters
     396   copied or -1 in case of an error.  Note that the resulting :c:type:`wchar_t`
    280397   string may or may not be 0-terminated.  It is the responsibility of the caller
    281    to make sure that the :ctype:`wchar_t` string is 0-terminated in case this is
    282    required by the application.
    283 
    284    .. versionchanged:: 2.5
    285       This function returned an :ctype:`int` type and used an :ctype:`int`
     398   to make sure that the :c:type:`wchar_t` string is 0-terminated in case this is
     399   required by the application. Also, note that the :c:type:`wchar_t*` string
     400   might contain null characters, which would cause the string to be truncated
     401   when used with most C functions.
     402
     403   .. versionchanged:: 2.5
     404      This function returned an :c:type:`int` type and used an :c:type:`int`
    286405      type for *size*. This might require changes in your code for properly
    287406      supporting 64-bit systems.
     
    296415these codecs are directly usable via the following functions.
    297416
    298 Many of the following APIs take two arguments encoding and errors. These
    299 parameters encoding and errors have the same semantics as the ones of the
    300 built-in :func:`unicode` Unicode object constructor.
     417Many of the following APIs take two arguments encoding and errors, and they
     418have the same semantics as the ones of the built-in :func:`unicode` Unicode
     419object constructor.
    301420
    302421Setting encoding to *NULL* causes the default encoding to be used which is
    303 ASCII.  The file system calls should use :cdata:`Py_FileSystemDefaultEncoding`
    304 as the encoding for file names. This variable should be treated as read-only: On
     422ASCII.  The file system calls should use :c:data:`Py_FileSystemDefaultEncoding`
     423as the encoding for file names. This variable should be treated as read-only: on
    305424some systems, it will be a pointer to a static string, on others, it will change
    306425at run-time (such as when the application invokes setlocale).
     
    313432generic ones are documented for simplicity.
    314433
     434
     435Generic Codecs
     436""""""""""""""
     437
    315438These are the generic codec APIs:
    316439
    317 .. % --- Generic Codecs -----------------------------------------------------
    318 
    319 
    320 .. cfunction:: PyObject* PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors)
     440
     441.. c:function:: PyObject* PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors)
    321442
    322443   Create a Unicode object by decoding *size* bytes of the encoded string *s*.
     
    327448
    328449   .. versionchanged:: 2.5
    329       This function used an :ctype:`int` type for *size*. This might require
    330       changes in your code for properly supporting 64-bit systems.
    331 
    332 
    333 .. cfunction:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors)
    334 
    335    Encode the :ctype:`Py_UNICODE` buffer of the given size and return a Python
     450      This function used an :c:type:`int` type for *size*. This might require
     451      changes in your code for properly supporting 64-bit systems.
     452
     453
     454.. c:function:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors)
     455
     456   Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a Python
    336457   string object.  *encoding* and *errors* have the same meaning as the parameters
    337    of the same name in the Unicode :meth:`encode` method.  The codec to be used is
    338    looked up using the Python codec registry.  Return *NULL* if an exception was
    339    raised by the codec.
    340 
    341    .. versionchanged:: 2.5
    342       This function used an :ctype:`int` type for *size*. This might require
    343       changes in your code for properly supporting 64-bit systems.
    344 
    345 
    346 .. cfunction:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors)
     458   of the same name in the Unicode :meth:`~unicode.encode` method.  The codec
     459   to be used is looked up using the Python codec registry.  Return *NULL* if
     460   an exception was raised by the codec.
     461
     462   .. versionchanged:: 2.5
     463      This function used an :c:type:`int` type for *size*. This might require
     464      changes in your code for properly supporting 64-bit systems.
     465
     466
     467.. c:function:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors)
    347468
    348469   Encode a Unicode object and return the result as Python string object.
     
    352473   codec.
    353474
     475
     476UTF-8 Codecs
     477""""""""""""
     478
    354479These are the UTF-8 codec APIs:
    355480
    356 .. % --- UTF-8 Codecs -------------------------------------------------------
    357 
    358 
    359 .. cfunction:: PyObject* PyUnicode_DecodeUTF8(const char *s, Py_ssize_t size, const char *errors)
     481
     482.. c:function:: PyObject* PyUnicode_DecodeUTF8(const char *s, Py_ssize_t size, const char *errors)
    360483
    361484   Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string
     
    363486
    364487   .. versionchanged:: 2.5
    365       This function used an :ctype:`int` type for *size*. This might require
    366       changes in your code for properly supporting 64-bit systems.
    367 
    368 
    369 .. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
    370 
    371    If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF8`. If
     488      This function used an :c:type:`int` type for *size*. This might require
     489      changes in your code for properly supporting 64-bit systems.
     490
     491
     492.. c:function:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
     493
     494   If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF8`. If
    372495   *consumed* is not *NULL*, trailing incomplete UTF-8 byte sequences will not be
    373496   treated as an error. Those bytes will not be decoded and the number of bytes
     
    377500
    378501   .. versionchanged:: 2.5
    379       This function used an :ctype:`int` type for *size*. This might require
    380       changes in your code for properly supporting 64-bit systems.
    381 
    382 
    383 .. cfunction:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
    384 
    385    Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-8 and return a
     502      This function used an :c:type:`int` type for *size*. This might require
     503      changes in your code for properly supporting 64-bit systems.
     504
     505
     506.. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
     507
     508   Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and return a
    386509   Python string object.  Return *NULL* if an exception was raised by the codec.
    387510
    388511   .. versionchanged:: 2.5
    389       This function used an :ctype:`int` type for *size*. This might require
    390       changes in your code for properly supporting 64-bit systems.
    391 
    392 
    393 .. cfunction:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode)
     512      This function used an :c:type:`int` type for *size*. This might require
     513      changes in your code for properly supporting 64-bit systems.
     514
     515
     516.. c:function:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode)
    394517
    395518   Encode a Unicode object using UTF-8 and return the result as Python string
     
    397520   by the codec.
    398521
     522
     523UTF-32 Codecs
     524"""""""""""""
     525
    399526These are the UTF-32 codec APIs:
    400527
    401 .. % --- UTF-32 Codecs ------------------------------------------------------ */
    402 
    403 
    404 .. cfunction:: PyObject* PyUnicode_DecodeUTF32(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
    405 
    406    Decode *length* bytes from a UTF-32 encoded buffer string and return the
     528
     529.. c:function:: PyObject* PyUnicode_DecodeUTF32(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
     530
     531   Decode *size* bytes from a UTF-32 encoded buffer string and return the
    407532   corresponding Unicode object.  *errors* (if non-*NULL*) defines the error
    408533   handling. It defaults to "strict".
     
    432557
    433558
    434 .. cfunction:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
    435 
    436    If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF32`. If
    437    *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeUTF32Stateful` will not treat
     559.. c:function:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
     560
     561   If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF32`. If
     562   *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeUTF32Stateful` will not treat
    438563   trailing incomplete UTF-32 byte sequences (such as a number of bytes not divisible
    439564   by four) as an error. Those bytes will not be decoded and the number of bytes
     
    443568
    444569
    445 .. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
     570.. c:function:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
    446571
    447572   Return a Python bytes object holding the UTF-32 encoded value of the Unicode
     
    463588
    464589
    465 .. cfunction:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
     590.. c:function:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
    466591
    467592   Return a Python string using the UTF-32 encoding in native byte order. The
     
    472597
    473598
     599UTF-16 Codecs
     600"""""""""""""
     601
    474602These are the UTF-16 codec APIs:
    475603
    476 .. % --- UTF-16 Codecs ------------------------------------------------------ */
    477 
    478 
    479 .. cfunction:: PyObject* PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
    480 
    481    Decode *length* bytes from a UTF-16 encoded buffer string and return the
     604
     605.. c:function:: PyObject* PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
     606
     607   Decode *size* bytes from a UTF-16 encoded buffer string and return the
    482608   corresponding Unicode object.  *errors* (if non-*NULL*) defines the error
    483609   handling. It defaults to "strict".
     
    504630
    505631   .. versionchanged:: 2.5
    506       This function used an :ctype:`int` type for *size*. This might require
    507       changes in your code for properly supporting 64-bit systems.
    508 
    509 
    510 .. cfunction:: PyObject* PyUnicode_DecodeUTF16Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
    511 
    512    If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF16`. If
    513    *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeUTF16Stateful` will not treat
     632      This function used an :c:type:`int` type for *size*. This might require
     633      changes in your code for properly supporting 64-bit systems.
     634
     635
     636.. c:function:: PyObject* PyUnicode_DecodeUTF16Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
     637
     638   If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF16`. If
     639   *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeUTF16Stateful` will not treat
    514640   trailing incomplete UTF-16 byte sequences (such as an odd number of bytes or a
    515641   split surrogate pair) as an error. Those bytes will not be decoded and the
     
    519645
    520646   .. versionchanged:: 2.5
    521       This function used an :ctype:`int` type for *size* and an :ctype:`int *`
     647      This function used an :c:type:`int` type for *size* and an :c:type:`int *`
    522648      type for *consumed*. This might require changes in your code for
    523649      properly supporting 64-bit systems.
    524650
    525651
    526 .. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
     652.. c:function:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
    527653
    528654   Return a Python string object holding the UTF-16 encoded value of the Unicode
     
    536662   mark (U+FEFF). In the other two modes, no BOM mark is prepended.
    537663
    538    If *Py_UNICODE_WIDE* is defined, a single :ctype:`Py_UNICODE` value may get
    539    represented as a surrogate pair. If it is not defined, each :ctype:`Py_UNICODE`
     664   If *Py_UNICODE_WIDE* is defined, a single :c:type:`Py_UNICODE` value may get
     665   represented as a surrogate pair. If it is not defined, each :c:type:`Py_UNICODE`
    540666   values is interpreted as an UCS-2 character.
    541667
     
    543669
    544670   .. versionchanged:: 2.5
    545       This function used an :ctype:`int` type for *size*. This might require
    546       changes in your code for properly supporting 64-bit systems.
    547 
    548 
    549 .. cfunction:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
     671      This function used an :c:type:`int` type for *size*. This might require
     672      changes in your code for properly supporting 64-bit systems.
     673
     674
     675.. c:function:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
    550676
    551677   Return a Python string using the UTF-16 encoding in native byte order. The
     
    553679   *NULL* if an exception was raised by the codec.
    554680
     681
     682UTF-7 Codecs
     683""""""""""""
     684
     685These are the UTF-7 codec APIs:
     686
     687
     688.. c:function:: PyObject* PyUnicode_DecodeUTF7(const char *s, Py_ssize_t size, const char *errors)
     689
     690   Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string
     691   *s*.  Return *NULL* if an exception was raised by the codec.
     692
     693
     694.. c:function:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
     695
     696   If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF7`.  If
     697   *consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not
     698   be treated as an error.  Those bytes will not be decoded and the number of
     699   bytes that have been decoded will be stored in *consumed*.
     700
     701
     702.. c:function:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, int base64SetO, int base64WhiteSpace, const char *errors)
     703
     704   Encode the :c:type:`Py_UNICODE` buffer of the given size using UTF-7 and
     705   return a Python bytes object.  Return *NULL* if an exception was raised by
     706   the codec.
     707
     708   If *base64SetO* is nonzero, "Set O" (punctuation that has no otherwise
     709   special meaning) will be encoded in base-64.  If *base64WhiteSpace* is
     710   nonzero, whitespace will be encoded in base-64.  Both are set to zero for the
     711   Python "utf-7" codec.
     712
     713
     714Unicode-Escape Codecs
     715"""""""""""""""""""""
     716
    555717These are the "Unicode Escape" codec APIs:
    556718
    557 .. % --- Unicode-Escape Codecs ----------------------------------------------
    558 
    559 
    560 .. cfunction:: PyObject* PyUnicode_DecodeUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
     719
     720.. c:function:: PyObject* PyUnicode_DecodeUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
    561721
    562722   Create a Unicode object by decoding *size* bytes of the Unicode-Escape encoded
     
    564724
    565725   .. versionchanged:: 2.5
    566       This function used an :ctype:`int` type for *size*. This might require
    567       changes in your code for properly supporting 64-bit systems.
    568 
    569 
    570 .. cfunction:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size)
    571 
    572    Encode the :ctype:`Py_UNICODE` buffer of the given size using Unicode-Escape and
     726      This function used an :c:type:`int` type for *size*. This might require
     727      changes in your code for properly supporting 64-bit systems.
     728
     729
     730.. c:function:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size)
     731
     732   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and
    573733   return a Python string object.  Return *NULL* if an exception was raised by the
    574734   codec.
    575735
    576736   .. versionchanged:: 2.5
    577       This function used an :ctype:`int` type for *size*. This might require
    578       changes in your code for properly supporting 64-bit systems.
    579 
    580 
    581 .. cfunction:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
     737      This function used an :c:type:`int` type for *size*. This might require
     738      changes in your code for properly supporting 64-bit systems.
     739
     740
     741.. c:function:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
    582742
    583743   Encode a Unicode object using Unicode-Escape and return the result as Python
     
    585745   raised by the codec.
    586746
     747
     748Raw-Unicode-Escape Codecs
     749"""""""""""""""""""""""""
     750
    587751These are the "Raw Unicode Escape" codec APIs:
    588752
    589 .. % --- Raw-Unicode-Escape Codecs ------------------------------------------
    590 
    591 
    592 .. cfunction:: PyObject* PyUnicode_DecodeRawUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
     753
     754.. c:function:: PyObject* PyUnicode_DecodeRawUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
    593755
    594756   Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape
     
    596758
    597759   .. versionchanged:: 2.5
    598       This function used an :ctype:`int` type for *size*. This might require
    599       changes in your code for properly supporting 64-bit systems.
    600 
    601 
    602 .. cfunction:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
    603 
    604    Encode the :ctype:`Py_UNICODE` buffer of the given size using Raw-Unicode-Escape
     760      This function used an :c:type:`int` type for *size*. This might require
     761      changes in your code for properly supporting 64-bit systems.
     762
     763
     764.. c:function:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
     765
     766   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape
    605767   and return a Python string object.  Return *NULL* if an exception was raised by
    606768   the codec.
    607769
    608770   .. versionchanged:: 2.5
    609       This function used an :ctype:`int` type for *size*. This might require
    610       changes in your code for properly supporting 64-bit systems.
    611 
    612 
    613 .. cfunction:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
     771      This function used an :c:type:`int` type for *size*. This might require
     772      changes in your code for properly supporting 64-bit systems.
     773
     774
     775.. c:function:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
    614776
    615777   Encode a Unicode object using Raw-Unicode-Escape and return the result as
     
    617779   was raised by the codec.
    618780
     781
     782Latin-1 Codecs
     783""""""""""""""
     784
    619785These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 Unicode
    620786ordinals and only these are accepted by the codecs during encoding.
    621787
    622 .. % --- Latin-1 Codecs -----------------------------------------------------
    623 
    624 
    625 .. cfunction:: PyObject* PyUnicode_DecodeLatin1(const char *s, Py_ssize_t size, const char *errors)
     788
     789.. c:function:: PyObject* PyUnicode_DecodeLatin1(const char *s, Py_ssize_t size, const char *errors)
    626790
    627791   Create a Unicode object by decoding *size* bytes of the Latin-1 encoded string
     
    629793
    630794   .. versionchanged:: 2.5
    631       This function used an :ctype:`int` type for *size*. This might require
    632       changes in your code for properly supporting 64-bit systems.
    633 
    634 
    635 .. cfunction:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
    636 
    637    Encode the :ctype:`Py_UNICODE` buffer of the given size using Latin-1 and return
     795      This function used an :c:type:`int` type for *size*. This might require
     796      changes in your code for properly supporting 64-bit systems.
     797
     798
     799.. c:function:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
     800
     801   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and return
    638802   a Python string object.  Return *NULL* if an exception was raised by the codec.
    639803
    640804   .. versionchanged:: 2.5
    641       This function used an :ctype:`int` type for *size*. This might require
    642       changes in your code for properly supporting 64-bit systems.
    643 
    644 
    645 .. cfunction:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
     805      This function used an :c:type:`int` type for *size*. This might require
     806      changes in your code for properly supporting 64-bit systems.
     807
     808
     809.. c:function:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
    646810
    647811   Encode a Unicode object using Latin-1 and return the result as Python string
     
    649813   by the codec.
    650814
     815
     816ASCII Codecs
     817""""""""""""
     818
    651819These are the ASCII codec APIs.  Only 7-bit ASCII data is accepted. All other
    652820codes generate errors.
    653821
    654 .. % --- ASCII Codecs -------------------------------------------------------
    655 
    656 
    657 .. cfunction:: PyObject* PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors)
     822
     823.. c:function:: PyObject* PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors)
    658824
    659825   Create a Unicode object by decoding *size* bytes of the ASCII encoded string
     
    661827
    662828   .. versionchanged:: 2.5
    663       This function used an :ctype:`int` type for *size*. This might require
    664       changes in your code for properly supporting 64-bit systems.
    665 
    666 
    667 .. cfunction:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
    668 
    669    Encode the :ctype:`Py_UNICODE` buffer of the given size using ASCII and return a
     829      This function used an :c:type:`int` type for *size*. This might require
     830      changes in your code for properly supporting 64-bit systems.
     831
     832
     833.. c:function:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
     834
     835   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and return a
    670836   Python string object.  Return *NULL* if an exception was raised by the codec.
    671837
    672838   .. versionchanged:: 2.5
    673       This function used an :ctype:`int` type for *size*. This might require
    674       changes in your code for properly supporting 64-bit systems.
    675 
    676 
    677 .. cfunction:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
     839      This function used an :c:type:`int` type for *size*. This might require
     840      changes in your code for properly supporting 64-bit systems.
     841
     842
     843.. c:function:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
    678844
    679845   Encode a Unicode object using ASCII and return the result as Python string
     
    681847   by the codec.
    682848
    683 These are the mapping codec APIs:
    684 
    685 .. % --- Character Map Codecs -----------------------------------------------
     849
     850Character Map Codecs
     851""""""""""""""""""""
    686852
    687853This codec is special in that it can be used to implement many different codecs
     
    706872characters to different code points.
    707873
    708 
    709 .. cfunction:: PyObject* PyUnicode_DecodeCharmap(const char *s, Py_ssize_t size, PyObject *mapping, const char *errors)
     874These are the mapping codec APIs:
     875
     876.. c:function:: PyObject* PyUnicode_DecodeCharmap(const char *s, Py_ssize_t size, PyObject *mapping, const char *errors)
    710877
    711878   Create a Unicode object by decoding *size* bytes of the encoded string *s* using
     
    720887
    721888   .. versionchanged:: 2.5
    722       This function used an :ctype:`int` type for *size*. This might require
    723       changes in your code for properly supporting 64-bit systems.
    724 
    725 
    726 .. cfunction:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors)
    727 
    728    Encode the :ctype:`Py_UNICODE` buffer of the given size using the given
     889      This function used an :c:type:`int` type for *size*. This might require
     890      changes in your code for properly supporting 64-bit systems.
     891
     892
     893.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors)
     894
     895   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given
    729896   *mapping* object and return a Python string object. Return *NULL* if an
    730897   exception was raised by the codec.
    731898
    732899   .. versionchanged:: 2.5
    733       This function used an :ctype:`int` type for *size*. This might require
    734       changes in your code for properly supporting 64-bit systems.
    735 
    736 
    737 .. cfunction:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping)
     900      This function used an :c:type:`int` type for *size*. This might require
     901      changes in your code for properly supporting 64-bit systems.
     902
     903
     904.. c:function:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping)
    738905
    739906   Encode a Unicode object using the given *mapping* object and return the result
     
    744911
    745912
    746 .. cfunction:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *table, const char *errors)
    747 
    748    Translate a :ctype:`Py_UNICODE` buffer of the given length by applying a
     913.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *table, const char *errors)
     914
     915   Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a
    749916   character mapping *table* to it and return the resulting Unicode object.  Return
    750917   *NULL* when an exception was raised by the codec.
     
    758925
    759926   .. versionchanged:: 2.5
    760       This function used an :ctype:`int` type for *size*. This might require
    761       changes in your code for properly supporting 64-bit systems.
     927      This function used an :c:type:`int` type for *size*. This might require
     928      changes in your code for properly supporting 64-bit systems.
     929
     930
     931MBCS codecs for Windows
     932"""""""""""""""""""""""
    762933
    763934These are the MBCS codec APIs. They are currently only available on Windows and
     
    766937the user settings on the machine running the codec.
    767938
    768 .. % --- MBCS codecs for Windows --------------------------------------------
    769 
    770 
    771 .. cfunction:: PyObject* PyUnicode_DecodeMBCS(const char *s, Py_ssize_t size, const char *errors)
     939
     940.. c:function:: PyObject* PyUnicode_DecodeMBCS(const char *s, Py_ssize_t size, const char *errors)
    772941
    773942   Create a Unicode object by decoding *size* bytes of the MBCS encoded string *s*.
     
    775944
    776945   .. versionchanged:: 2.5
    777       This function used an :ctype:`int` type for *size*. This might require
    778       changes in your code for properly supporting 64-bit systems.
    779 
    780 
    781 .. cfunction:: PyObject* PyUnicode_DecodeMBCSStateful(const char *s, int size, const char *errors, int *consumed)
    782 
    783    If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeMBCS`. If
    784    *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeMBCSStateful` will not decode
     946      This function used an :c:type:`int` type for *size*. This might require
     947      changes in your code for properly supporting 64-bit systems.
     948
     949
     950.. c:function:: PyObject* PyUnicode_DecodeMBCSStateful(const char *s, int size, const char *errors, int *consumed)
     951
     952   If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeMBCS`. If
     953   *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeMBCSStateful` will not decode
    785954   trailing lead byte and the number of bytes that have been decoded will be stored
    786955   in *consumed*.
     
    789958
    790959
    791 .. cfunction:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
    792 
    793    Encode the :ctype:`Py_UNICODE` buffer of the given size using MBCS and return a
     960.. c:function:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
     961
     962   Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and return a
    794963   Python string object.  Return *NULL* if an exception was raised by the codec.
    795964
    796965   .. versionchanged:: 2.5
    797       This function used an :ctype:`int` type for *size*. This might require
    798       changes in your code for properly supporting 64-bit systems.
    799 
    800 
    801 .. cfunction:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
     966      This function used an :c:type:`int` type for *size*. This might require
     967      changes in your code for properly supporting 64-bit systems.
     968
     969
     970.. c:function:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
    802971
    803972   Encode a Unicode object using MBCS and return the result as Python string
     
    805974   by the codec.
    806975
    807 .. % --- Methods & Slots ----------------------------------------------------
    808 
     976
     977Methods & Slots
     978"""""""""""""""
    809979
    810980.. _unicodemethodsandslots:
     
    820990
    821991
    822 .. cfunction:: PyObject* PyUnicode_Concat(PyObject *left, PyObject *right)
     992.. c:function:: PyObject* PyUnicode_Concat(PyObject *left, PyObject *right)
    823993
    824994   Concat two strings giving a new Unicode string.
    825995
    826996
    827 .. cfunction:: PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit)
    828 
    829    Split a string giving a list of Unicode strings.  If sep is *NULL*, splitting
     997.. c:function:: PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit)
     998
     999   Split a string giving a list of Unicode strings.  If *sep* is *NULL*, splitting
    8301000   will be done at all whitespace substrings.  Otherwise, splits occur at the given
    8311001   separator.  At most *maxsplit* splits will be done.  If negative, no limit is
     
    8331003
    8341004   .. versionchanged:: 2.5
    835       This function used an :ctype:`int` type for *maxsplit*. This might require
    836       changes in your code for properly supporting 64-bit systems.
    837 
    838 
    839 .. cfunction:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend)
     1005      This function used an :c:type:`int` type for *maxsplit*. This might require
     1006      changes in your code for properly supporting 64-bit systems.
     1007
     1008
     1009.. c:function:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend)
    8401010
    8411011   Split a Unicode string at line breaks, returning a list of Unicode strings.
     
    8441014
    8451015
    846 .. cfunction:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)
     1016.. c:function:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)
    8471017
    8481018   Translate a string by applying a character mapping table to it and return the
     
    8601030
    8611031
    862 .. cfunction:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)
    863 
    864    Join a sequence of strings using the given separator and return the resulting
     1032.. c:function:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)
     1033
     1034   Join a sequence of strings using the given *separator* and return the resulting
    8651035   Unicode string.
    8661036
    8671037
    868 .. cfunction:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction)
    869 
    870    Return 1 if *substr* matches *str*[*start*:*end*] at the given tail end
     1038.. c:function:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction)
     1039
     1040   Return 1 if *substr* matches ``str[start:end]`` at the given tail end
    8711041   (*direction* == -1 means to do a prefix match, *direction* == 1 a suffix match),
    8721042   0 otherwise. Return ``-1`` if an error occurred.
    8731043
    8741044   .. versionchanged:: 2.5
    875       This function used an :ctype:`int` type for *start* and *end*. This
     1045      This function used an :c:type:`int` type for *start* and *end*. This
    8761046      might require changes in your code for properly supporting 64-bit
    8771047      systems.
    8781048
    8791049
    880 .. cfunction:: Py_ssize_t PyUnicode_Find(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction)
    881 
    882    Return the first position of *substr* in *str*[*start*:*end*] using the given
     1050.. c:function:: Py_ssize_t PyUnicode_Find(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction)
     1051
     1052   Return the first position of *substr* in ``str[start:end]`` using the given
    8831053   *direction* (*direction* == 1 means to do a forward search, *direction* == -1 a
    8841054   backward search).  The return value is the index of the first match; a value of
     
    8871057
    8881058   .. versionchanged:: 2.5
    889       This function used an :ctype:`int` type for *start* and *end*. This
     1059      This function used an :c:type:`int` type for *start* and *end*. This
    8901060      might require changes in your code for properly supporting 64-bit
    8911061      systems.
    8921062
    8931063
    894 .. cfunction:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end)
     1064.. c:function:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end)
    8951065
    8961066   Return the number of non-overlapping occurrences of *substr* in
     
    8981068
    8991069   .. versionchanged:: 2.5
    900       This function returned an :ctype:`int` type and used an :ctype:`int`
     1070      This function returned an :c:type:`int` type and used an :c:type:`int`
    9011071      type for *start* and *end*. This might require changes in your code for
    9021072      properly supporting 64-bit systems.
    9031073
    9041074
    905 .. cfunction:: PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount)
     1075.. c:function:: PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount)
    9061076
    9071077   Replace at most *maxcount* occurrences of *substr* in *str* with *replstr* and
     
    9101080
    9111081   .. versionchanged:: 2.5
    912       This function used an :ctype:`int` type for *maxcount*. This might
     1082      This function used an :c:type:`int` type for *maxcount*. This might
    9131083      require changes in your code for properly supporting 64-bit systems.
    9141084
    9151085
    916 .. cfunction:: int PyUnicode_Compare(PyObject *left, PyObject *right)
     1086.. c:function:: int PyUnicode_Compare(PyObject *left, PyObject *right)
    9171087
    9181088   Compare two strings and return -1, 0, 1 for less than, equal, and greater than,
     
    9201090
    9211091
    922 .. cfunction:: int PyUnicode_RichCompare(PyObject *left,  PyObject *right,  int op)
     1092.. c:function:: int PyUnicode_RichCompare(PyObject *left,  PyObject *right,  int op)
    9231093
    9241094   Rich compare two unicode strings and return one of the following:
     
    9361106
    9371107
    938 .. cfunction:: PyObject* PyUnicode_Format(PyObject *format, PyObject *args)
     1108.. c:function:: PyObject* PyUnicode_Format(PyObject *format, PyObject *args)
    9391109
    9401110   Return a new string object from *format* and *args*; this is analogous to
     
    9421112
    9431113
    944 .. cfunction:: int PyUnicode_Contains(PyObject *container, PyObject *element)
     1114.. c:function:: int PyUnicode_Contains(PyObject *container, PyObject *element)
    9451115
    9461116   Check whether *element* is contained in *container* and return true or false
Note: See TracChangeset for help on using the changeset viewer.