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/buffer.rst

    r2 r391  
    33.. _bufferobjects:
    44
    5 Buffer Objects
    6 --------------
     5Buffers and Memoryview Objects
     6------------------------------
    77
    88.. sectionauthor:: Greg Stein <gstein@lyra.org>
     9.. sectionauthor:: Benjamin Peterson
    910
    1011
     
    2728method. Any object that can export a series of bytes through the buffer
    2829interface can be written to a file. There are a number of format codes to
    29 :cfunc:`PyArg_ParseTuple` that operate against an object's buffer interface,
     30:c:func:`PyArg_ParseTuple` that operate against an object's buffer interface,
    3031returning data from the target object.
    3132
     
    3334objects and a C-level buffer API so that any built-in or used-defined type can
    3435expose its characteristics. Both, however, have been deprecated because of
    35 various shortcomings, and have been officially removed in Python 3.0 in favour
     36various shortcomings, and have been officially removed in Python 3 in favour
    3637of a new C-level buffer API and a new Python-level object named
    3738:class:`memoryview`.
     
    4748
    4849
    49 .. ctype:: Py_buffer
    50 
    51    .. cmember:: void *buf
     50.. c:type:: Py_buffer
     51
     52   .. c:member:: void *buf
    5253
    5354      A pointer to the start of the memory for the object.
    5455
    55    .. cmember:: Py_ssize_t len
     56   .. c:member:: Py_ssize_t len
    5657      :noindex:
    5758
    5859      The total length of the memory in bytes.
    5960
    60    .. cmember:: int readonly
     61   .. c:member:: int readonly
    6162
    6263      An indicator of whether the buffer is read only.
    6364
    64    .. cmember:: const char *format
     65   .. c:member:: const char *format
    6566      :noindex:
    6667
     
    6970      *NULL*, ``"B"`` (unsigned bytes) is assumed.
    7071
    71    .. cmember:: int ndim
     72   .. c:member:: int ndim
    7273
    7374      The number of dimensions the memory represents as a multi-dimensional
    74       array.  If it is 0, :cdata:`strides` and :cdata:`suboffsets` must be
     75      array.  If it is 0, :c:data:`strides` and :c:data:`suboffsets` must be
    7576      *NULL*.
    7677
    77    .. cmember:: Py_ssize_t *shape
    78 
    79       An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the
     78   .. c:member:: Py_ssize_t *shape
     79
     80      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the
    8081      shape of the memory as a multi-dimensional array.  Note that
    8182      ``((*shape)[0] * ... * (*shape)[ndims-1])*itemsize`` should be equal to
    82       :cdata:`len`.
    83 
    84    .. cmember:: Py_ssize_t *strides
    85 
    86       An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the
     83      :c:data:`len`.
     84
     85   .. c:member:: Py_ssize_t *strides
     86
     87      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the
    8788      number of bytes to skip to get to a new element in each dimension.
    8889
    89    .. cmember:: Py_ssize_t *suboffsets
    90 
    91       An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim`.  If these
     90   .. c:member:: Py_ssize_t *suboffsets
     91
     92      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim`.  If these
    9293      suboffset numbers are greater than or equal to 0, then the value stored
    9394      along the indicated dimension is a pointer and the suboffset value
     
    114115
    115116
    116    .. cmember:: Py_ssize_t itemsize
     117   .. c:member:: Py_ssize_t itemsize
    117118
    118119      This is a storage for the itemsize (in bytes) of each element of the
    119120      shared memory. It is technically un-necessary as it can be obtained
    120       using :cfunc:`PyBuffer_SizeFromFormat`, however an exporter may know
     121      using :c:func:`PyBuffer_SizeFromFormat`, however an exporter may know
    121122      this information without parsing the format string and it is necessary
    122123      to know the itemsize for proper interpretation of striding. Therefore,
    123124      storing it is more convenient and faster.
    124125
    125    .. cmember:: void *internal
     126   .. c:member:: void *internal
    126127
    127128      This is for use internally by the exporting object. For example, this
     
    136137
    137138
    138 .. cfunction:: int PyObject_CheckBuffer(PyObject *obj)
     139.. c:function:: int PyObject_CheckBuffer(PyObject *obj)
    139140
    140141   Return 1 if *obj* supports the buffer interface otherwise 0.
    141142
    142143
    143 .. cfunction:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)
    144 
    145       Export *obj* into a :ctype:`Py_buffer`, *view*.  These arguments must
     144.. c:function:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)
     145
     146      Export *obj* into a :c:type:`Py_buffer`, *view*.  These arguments must
    146147      never be *NULL*.  The *flags* argument is a bit field indicating what
    147148      kind of buffer the caller is prepared to deal with and therefore what
     
    156157      there is another error that is actually causing the problem. The
    157158      exporter can use flags information to simplify how much of the
    158       :cdata:`Py_buffer` structure is filled in with non-default values and/or
     159      :c:data:`Py_buffer` structure is filled in with non-default values and/or
    159160      raise an error if the object can't support a simpler view of its memory.
    160161
     
    163164      The following table gives possible values to the *flags* arguments.
    164165
    165       +------------------------------+---------------------------------------------------+
    166       | Flag                         | Description                                       |
    167       +==============================+===================================================+
    168       | :cmacro:`PyBUF_SIMPLE`       | This is the default flag state.  The returned     |
    169       |                              | buffer may or may not have writable memory.  The  |
    170       |                              | format of the data will be assumed to be unsigned |
    171       |                              | bytes.  This is a "stand-alone" flag constant. It |
    172       |                              | never needs to be '|'d to the others. The exporter|
    173       |                              | will raise an error if it cannot provide such a   |
    174       |                              | contiguous buffer of bytes.                       |
    175       |                              |                                                   |
    176       +------------------------------+---------------------------------------------------+
    177       | :cmacro:`PyBUF_WRITABLE`     | The returned buffer must be writable.  If it is   |
    178       |                              | not writable, then raise an error.                |
    179       +------------------------------+---------------------------------------------------+
    180       | :cmacro:`PyBUF_STRIDES`      | This implies :cmacro:`PyBUF_ND`. The returned     |
    181       |                              | buffer must provide strides information (i.e. the |
    182       |                              | strides cannot be NULL). This would be used when  |
    183       |                              | the consumer can handle strided, discontiguous    |
    184       |                              | arrays.  Handling strides automatically assumes   |
    185       |                              | you can handle shape.  The exporter can raise an  |
    186       |                              | error if a strided representation of the data is  |
    187       |                              | not possible (i.e. without the suboffsets).       |
    188       |                              |                                                   |
    189       +------------------------------+---------------------------------------------------+
    190       | :cmacro:`PyBUF_ND`           | The returned buffer must provide shape            |
    191       |                              | information. The memory will be assumed C-style   |
    192       |                              | contiguous (last dimension varies the             |
    193       |                              | fastest). The exporter may raise an error if it   |
    194       |                              | cannot provide this kind of contiguous buffer. If |
    195       |                              | this is not given then shape will be *NULL*.      |
    196       |                              |                                                   |
    197       |                              |                                                   |
    198       |                              |                                                   |
    199       +------------------------------+---------------------------------------------------+
    200       |:cmacro:`PyBUF_C_CONTIGUOUS`  | These flags indicate that the contiguity returned |
    201       |:cmacro:`PyBUF_F_CONTIGUOUS`  | buffer must be respectively, C-contiguous (last   |
    202       |:cmacro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous |
    203       |                              | (first dimension varies the fastest) or either    |
    204       |                              | one.  All of these flags imply                    |
    205       |                              | :cmacro:`PyBUF_STRIDES` and guarantee that the    |
    206       |                              | strides buffer info structure will be filled in   |
    207       |                              | correctly.                                        |
    208       |                              |                                                   |
    209       +------------------------------+---------------------------------------------------+
    210       | :cmacro:`PyBUF_INDIRECT`     | This flag indicates the returned buffer must have |
    211       |                              | suboffsets information (which can be NULL if no   |
    212       |                              | suboffsets are needed).  This can be used when    |
    213       |                              | the consumer can handle indirect array            |
    214       |                              | referencing implied by these suboffsets. This     |
    215       |                              | implies :cmacro:`PyBUF_STRIDES`.                  |
    216       |                              |                                                   |
    217       |                              |                                                   |
    218       |                              |                                                   |
    219       +------------------------------+---------------------------------------------------+
    220       | :cmacro:`PyBUF_FORMAT`       | The returned buffer must have true format         |
    221       |                              | information if this flag is provided. This would  |
    222       |                              | be used when the consumer is going to be checking |
    223       |                              | for what 'kind' of data is actually stored. An    |
    224       |                              | exporter should always be able to provide this    |
    225       |                              | information if requested. If format is not        |
    226       |                              | explicitly requested then the format must be      |
    227       |                              | returned as *NULL* (which means ``'B'``, or       |
    228       |                              | unsigned bytes)                                   |
    229       +------------------------------+---------------------------------------------------+
    230       | :cmacro:`PyBUF_STRIDED`      | This is equivalent to ``(PyBUF_STRIDES |          |
    231       |                              | PyBUF_WRITABLE)``.                                |
    232       +------------------------------+---------------------------------------------------+
    233       | :cmacro:`PyBUF_STRIDED_RO`   | This is equivalent to ``(PyBUF_STRIDES)``.        |
    234       |                              |                                                   |
    235       +------------------------------+---------------------------------------------------+
    236       | :cmacro:`PyBUF_RECORDS`      | This is equivalent to ``(PyBUF_STRIDES |          |
    237       |                              | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
    238       +------------------------------+---------------------------------------------------+
    239       | :cmacro:`PyBUF_RECORDS_RO`   | This is equivalent to ``(PyBUF_STRIDES |          |
    240       |                              | PyBUF_FORMAT)``.                                  |
    241       +------------------------------+---------------------------------------------------+
    242       | :cmacro:`PyBUF_FULL`         | This is equivalent to ``(PyBUF_INDIRECT |         |
    243       |                              | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
    244       +------------------------------+---------------------------------------------------+
    245       | :cmacro:`PyBUF_FULL_RO`      | This is equivalent to ``(PyBUF_INDIRECT |         |
    246       |                              | PyBUF_FORMAT)``.                                  |
    247       +------------------------------+---------------------------------------------------+
    248       | :cmacro:`PyBUF_CONTIG`       | This is equivalent to ``(PyBUF_ND |               |
    249       |                              | PyBUF_WRITABLE)``.                                |
    250       +------------------------------+---------------------------------------------------+
    251       | :cmacro:`PyBUF_CONTIG_RO`    | This is equivalent to ``(PyBUF_ND)``.             |
    252       |                              |                                                   |
    253       +------------------------------+---------------------------------------------------+
    254 
    255 
    256 .. cfunction:: void PyBuffer_Release(Py_buffer *view)
     166      +-------------------------------+---------------------------------------------------+
     167      | Flag                          | Description                                       |
     168      +===============================+===================================================+
     169      | :c:macro:`PyBUF_SIMPLE`       | This is the default flag state.  The returned     |
     170      |                               | buffer may or may not have writable memory.  The  |
     171      |                               | format of the data will be assumed to be unsigned |
     172      |                               | bytes.  This is a "stand-alone" flag constant. It |
     173      |                               | never needs to be '|'d to the others. The exporter|
     174      |                               | will raise an error if it cannot provide such a   |
     175      |                               | contiguous buffer of bytes.                       |
     176      |                               |                                                   |
     177      +-------------------------------+---------------------------------------------------+
     178      | :c:macro:`PyBUF_WRITABLE`     | The returned buffer must be writable.  If it is   |
     179      |                               | not writable, then raise an error.                |
     180      +-------------------------------+---------------------------------------------------+
     181      | :c:macro:`PyBUF_STRIDES`      | This implies :c:macro:`PyBUF_ND`. The returned    |
     182      |                               | buffer must provide strides information (i.e. the |
     183      |                               | strides cannot be NULL). This would be used when  |
     184      |                               | the consumer can handle strided, discontiguous    |
     185      |                               | arrays.  Handling strides automatically assumes   |
     186      |                               | you can handle shape.  The exporter can raise an  |
     187      |                               | error if a strided representation of the data is  |
     188      |                               | not possible (i.e. without the suboffsets).       |
     189      |                               |                                                   |
     190      +-------------------------------+---------------------------------------------------+
     191      | :c:macro:`PyBUF_ND`           | The returned buffer must provide shape            |
     192      |                               | information. The memory will be assumed C-style   |
     193      |                               | contiguous (last dimension varies the             |
     194      |                               | fastest). The exporter may raise an error if it   |
     195      |                               | cannot provide this kind of contiguous buffer. If |
     196      |                               | this is not given then shape will be *NULL*.      |
     197      |                               |                                                   |
     198      |                               |                                                   |
     199      |                               |                                                   |
     200      +-------------------------------+---------------------------------------------------+
     201      |:c:macro:`PyBUF_C_CONTIGUOUS`  | These flags indicate that the contiguity returned |
     202      |:c:macro:`PyBUF_F_CONTIGUOUS`  | buffer must be respectively, C-contiguous (last   |
     203      |:c:macro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous |
     204      |                               | (first dimension varies the fastest) or either    |
     205      |                               | one.  All of these flags imply                    |
     206      |                               | :c:macro:`PyBUF_STRIDES` and guarantee that the   |
     207      |                               | strides buffer info structure will be filled in   |
     208      |                               | correctly.                                        |
     209      |                               |                                                   |
     210      +-------------------------------+---------------------------------------------------+
     211      | :c:macro:`PyBUF_INDIRECT`     | This flag indicates the returned buffer must have |
     212      |                               | suboffsets information (which can be NULL if no   |
     213      |                               | suboffsets are needed).  This can be used when    |
     214      |                               | the consumer can handle indirect array            |
     215      |                               | referencing implied by these suboffsets. This     |
     216      |                               | implies :c:macro:`PyBUF_STRIDES`.                 |
     217      |                               |                                                   |
     218      |                               |                                                   |
     219      |                               |                                                   |
     220      +-------------------------------+---------------------------------------------------+
     221      | :c:macro:`PyBUF_FORMAT`       | The returned buffer must have true format         |
     222      |                               | information if this flag is provided. This would  |
     223      |                               | be used when the consumer is going to be checking |
     224      |                               | for what 'kind' of data is actually stored. An    |
     225      |                               | exporter should always be able to provide this    |
     226      |                               | information if requested. If format is not        |
     227      |                               | explicitly requested then the format must be      |
     228      |                               | returned as *NULL* (which means ``'B'``, or       |
     229      |                               | unsigned bytes)                                   |
     230      +-------------------------------+---------------------------------------------------+
     231      | :c:macro:`PyBUF_STRIDED`      | This is equivalent to ``(PyBUF_STRIDES |          |
     232      |                               | PyBUF_WRITABLE)``.                                |
     233      +-------------------------------+---------------------------------------------------+
     234      | :c:macro:`PyBUF_STRIDED_RO`   | This is equivalent to ``(PyBUF_STRIDES)``.        |
     235      |                               |                                                   |
     236      +-------------------------------+---------------------------------------------------+
     237      | :c:macro:`PyBUF_RECORDS`      | This is equivalent to ``(PyBUF_STRIDES |          |
     238      |                               | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
     239      +-------------------------------+---------------------------------------------------+
     240      | :c:macro:`PyBUF_RECORDS_RO`   | This is equivalent to ``(PyBUF_STRIDES |          |
     241      |                               | PyBUF_FORMAT)``.                                  |
     242      +-------------------------------+---------------------------------------------------+
     243      | :c:macro:`PyBUF_FULL`         | This is equivalent to ``(PyBUF_INDIRECT |         |
     244      |                               | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
     245      +-------------------------------+---------------------------------------------------+
     246      | :c:macro:`PyBUF_FULL_RO`      | This is equivalent to ``(PyBUF_INDIRECT |         |
     247      |                               | PyBUF_FORMAT)``.                                  |
     248      +-------------------------------+---------------------------------------------------+
     249      | :c:macro:`PyBUF_CONTIG`       | This is equivalent to ``(PyBUF_ND |               |
     250      |                               | PyBUF_WRITABLE)``.                                |
     251      +-------------------------------+---------------------------------------------------+
     252      | :c:macro:`PyBUF_CONTIG_RO`    | This is equivalent to ``(PyBUF_ND)``.             |
     253      |                               |                                                   |
     254      +-------------------------------+---------------------------------------------------+
     255
     256
     257.. c:function:: void PyBuffer_Release(Py_buffer *view)
    257258
    258259   Release the buffer *view*.  This should be called when the buffer
     
    260261
    261262
    262 .. cfunction:: Py_ssize_t PyBuffer_SizeFromFormat(const char *)
    263 
    264    Return the implied :cdata:`~Py_buffer.itemsize` from the struct-stype
    265    :cdata:`~Py_buffer.format`.
    266 
    267 
    268 .. cfunction:: int PyObject_CopyToObject(PyObject *obj, void *buf, Py_ssize_t len, char fortran)
    269 
    270    Copy *len* bytes of data pointed to by the contiguous chunk of memory
    271    pointed to by *buf* into the buffer exported by obj.  The buffer must of
    272    course be writable.  Return 0 on success and return -1 and raise an error
    273    on failure.  If the object does not have a writable buffer, then an error
    274    is raised.  If *fortran* is ``'F'``, then if the object is
    275    multi-dimensional, then the data will be copied into the array in
    276    Fortran-style (first dimension varies the fastest).  If *fortran* is
    277    ``'C'``, then the data will be copied into the array in C-style (last
    278    dimension varies the fastest).  If *fortran* is ``'A'``, then it does not
    279    matter and the copy will be made in whatever way is more efficient.
    280 
    281 
    282 .. cfunction:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran)
     263.. c:function:: Py_ssize_t PyBuffer_SizeFromFormat(const char *)
     264
     265   Return the implied :c:data:`~Py_buffer.itemsize` from the struct-stype
     266   :c:data:`~Py_buffer.format`.
     267
     268
     269.. c:function:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran)
    283270
    284271   Return 1 if the memory defined by the *view* is C-style (*fortran* is
     
    287274
    288275
    289 .. cfunction:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran)
     276.. c:function:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran)
    290277
    291278   Fill the *strides* array with byte-strides of a contiguous (C-style if
    292    *fortran* is ``'C'`` or Fortran-style if *fortran* is ``'F'`` array of the
     279   *fortran* is ``'C'`` or Fortran-style if *fortran* is ``'F'``) array of the
    293280   given shape with the given number of bytes per element.
    294281
    295282
    296 .. cfunction:: int PyBuffer_FillInfo(Py_buffer *view, void *buf, Py_ssize_t len, int readonly, int infoflags)
     283.. c:function:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags)
    297284
    298285   Fill in a buffer-info structure, *view*, correctly for an exporter that can
     
    301288
    302289
     290MemoryView objects
     291==================
     292
     293.. versionadded:: 2.7
     294
     295A :class:`memoryview` object exposes the new C level buffer interface as a
     296Python object which can then be passed around like any other object.
     297
     298.. c:function:: PyObject *PyMemoryView_FromObject(PyObject *obj)
     299
     300   Create a memoryview object from an object that defines the new buffer
     301   interface.
     302
     303
     304.. c:function:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view)
     305
     306   Create a memoryview object wrapping the given buffer-info structure *view*.
     307   The memoryview object then owns the buffer, which means you shouldn't
     308   try to release it yourself: it will be released on deallocation of the
     309   memoryview object.
     310
     311
     312.. c:function:: PyObject *PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
     313
     314   Create a memoryview object to a contiguous chunk of memory (in either
     315   'C' or 'F'ortran *order*) from an object that defines the buffer
     316   interface. If memory is contiguous, the memoryview object points to the
     317   original memory. Otherwise copy is made and the memoryview points to a
     318   new bytes object.
     319
     320
     321.. c:function:: int PyMemoryView_Check(PyObject *obj)
     322
     323   Return true if the object *obj* is a memoryview object.  It is not
     324   currently allowed to create subclasses of :class:`memoryview`.
     325
     326
     327.. c:function:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *obj)
     328
     329   Return a pointer to the buffer-info structure wrapped by the given
     330   object.  The object **must** be a memoryview instance; this macro doesn't
     331   check its type, you must do it yourself or you will risk crashes.
     332
     333
    303334Old-style buffer objects
    304335========================
     
    306337.. index:: single: PyBufferProcs
    307338
    308 More information on the buffer interface is provided in the section
    309 :ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`.
     339More information on the old buffer interface is provided in the section
     340:ref:`buffer-structs`, under the description for :c:type:`PyBufferProcs`.
    310341
    311342A "buffer object" is defined in the :file:`bufferobject.h` header (included by
     
    326357
    327358
    328 .. ctype:: PyBufferObject
    329 
    330    This subtype of :ctype:`PyObject` represents a buffer object.
    331 
    332 
    333 .. cvar:: PyTypeObject PyBuffer_Type
     359.. c:type:: PyBufferObject
     360
     361   This subtype of :c:type:`PyObject` represents a buffer object.
     362
     363
     364.. c:var:: PyTypeObject PyBuffer_Type
    334365
    335366   .. index:: single: BufferType (in module types)
    336367
    337    The instance of :ctype:`PyTypeObject` which represents the Python buffer type;
     368   The instance of :c:type:`PyTypeObject` which represents the Python buffer type;
    338369   it is the same object as ``buffer`` and  ``types.BufferType`` in the Python
    339370   layer. .
    340371
    341372
    342 .. cvar:: int Py_END_OF_BUFFER
     373.. c:var:: int Py_END_OF_BUFFER
    343374
    344375   This constant may be passed as the *size* parameter to
    345    :cfunc:`PyBuffer_FromObject` or :cfunc:`PyBuffer_FromReadWriteObject`.  It
    346    indicates that the new :ctype:`PyBufferObject` should refer to *base*
     376   :c:func:`PyBuffer_FromObject` or :c:func:`PyBuffer_FromReadWriteObject`.  It
     377   indicates that the new :c:type:`PyBufferObject` should refer to *base*
    347378   object from the specified *offset* to the end of its exported buffer.
    348379   Using this enables the caller to avoid querying the *base* object for its
     
    350381
    351382
    352 .. cfunction:: int PyBuffer_Check(PyObject *p)
    353 
    354    Return true if the argument has type :cdata:`PyBuffer_Type`.
    355 
    356 
    357 .. cfunction:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
     383.. c:function:: int PyBuffer_Check(PyObject *p)
     384
     385   Return true if the argument has type :c:data:`PyBuffer_Type`.
     386
     387
     388.. c:function:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
    358389
    359390   Return a new read-only buffer object.  This raises :exc:`TypeError` if
     
    367398
    368399   .. versionchanged:: 2.5
    369       This function used an :ctype:`int` type for *offset* and *size*. This
     400      This function used an :c:type:`int` type for *offset* and *size*. This
    370401      might require changes in your code for properly supporting 64-bit
    371402      systems.
    372403
    373404
    374 .. cfunction:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
     405.. c:function:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
    375406
    376407   Return a new writable buffer object.  Parameters and exceptions are similar
    377    to those for :cfunc:`PyBuffer_FromObject`.  If the *base* object does not
     408   to those for :c:func:`PyBuffer_FromObject`.  If the *base* object does not
    378409   export the writeable buffer protocol, then :exc:`TypeError` is raised.
    379410
    380411   .. versionchanged:: 2.5
    381       This function used an :ctype:`int` type for *offset* and *size*. This
     412      This function used an :c:type:`int` type for *offset* and *size*. This
    382413      might require changes in your code for properly supporting 64-bit
    383414      systems.
    384415
    385416
    386 .. cfunction:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
     417.. c:function:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
    387418
    388419   Return a new read-only buffer object that reads from a specified location
     
    394425
    395426   .. versionchanged:: 2.5
    396       This function used an :ctype:`int` type for *size*. This might require
     427      This function used an :c:type:`int` type for *size*. This might require
    397428      changes in your code for properly supporting 64-bit systems.
    398429
    399430
    400 .. cfunction:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
    401 
    402    Similar to :cfunc:`PyBuffer_FromMemory`, but the returned buffer is
     431.. c:function:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
     432
     433   Similar to :c:func:`PyBuffer_FromMemory`, but the returned buffer is
    403434   writable.
    404435
    405436   .. versionchanged:: 2.5
    406       This function used an :ctype:`int` type for *size*. This might require
     437      This function used an :c:type:`int` type for *size*. This might require
    407438      changes in your code for properly supporting 64-bit systems.
    408439
    409440
    410 .. cfunction:: PyObject* PyBuffer_New(Py_ssize_t size)
     441.. c:function:: PyObject* PyBuffer_New(Py_ssize_t size)
    411442
    412443   Return a new writable buffer object that maintains its own memory buffer of
    413444   *size* bytes.  :exc:`ValueError` is returned if *size* is not zero or
    414445   positive.  Note that the memory buffer (as returned by
    415    :cfunc:`PyObject_AsWriteBuffer`) is not specifically aligned.
     446   :c:func:`PyObject_AsWriteBuffer`) is not specifically aligned.
    416447
    417448   .. versionchanged:: 2.5
    418       This function used an :ctype:`int` type for *size*. This might require
     449      This function used an :c:type:`int` type for *size*. This might require
    419450      changes in your code for properly supporting 64-bit systems.
Note: See TracChangeset for help on using the changeset viewer.