mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
bpo-46140: take more Py_buffer arguments as const * (GH-30217)
This commit is contained in:
parent
fc54e722a2
commit
31ff96712e
7 changed files with 23 additions and 22 deletions
|
|
@ -470,27 +470,27 @@ Buffer-related functions
|
|||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
.. c:function:: int PyBuffer_IsContiguous(Py_buffer *view, char order)
|
||||
.. c:function:: int PyBuffer_IsContiguous(const Py_buffer *view, char order)
|
||||
|
||||
Return ``1`` if the memory defined by the *view* is C-style (*order* is
|
||||
``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either one
|
||||
(*order* is ``'A'``). Return ``0`` otherwise. This function always succeeds.
|
||||
|
||||
|
||||
.. c:function:: void* PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices)
|
||||
.. c:function:: void* PyBuffer_GetPointer(const Py_buffer *view, const Py_ssize_t *indices)
|
||||
|
||||
Get the memory area pointed to by the *indices* inside the given *view*.
|
||||
*indices* must point to an array of ``view->ndim`` indices.
|
||||
|
||||
|
||||
.. c:function:: int PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
|
||||
.. c:function:: int PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char fort)
|
||||
|
||||
Copy contiguous *len* bytes from *buf* to *view*.
|
||||
*fort* can be ``'C'`` or ``'F'`` (for C-style or Fortran-style ordering).
|
||||
``0`` is returned on success, ``-1`` on error.
|
||||
|
||||
|
||||
.. c:function:: int PyBuffer_ToContiguous(void *buf, Py_buffer *src, Py_ssize_t len, char order)
|
||||
.. c:function:: int PyBuffer_ToContiguous(void *buf, const Py_buffer *src, Py_ssize_t len, char order)
|
||||
|
||||
Copy *len* bytes from *src* to its contiguous representation in *buf*.
|
||||
*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ any other object.
|
|||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
.. c:function:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view)
|
||||
.. c:function:: PyObject *PyMemoryView_FromBuffer(const Py_buffer *view)
|
||||
|
||||
Create a memoryview object wrapping the given buffer structure *view*.
|
||||
For simple byte buffers, :c:func:`PyMemoryView_FromMemory` is the preferred
|
||||
|
|
@ -61,4 +61,3 @@ any other object.
|
|||
on or ``NULL`` if the memoryview has been created by one of the functions
|
||||
:c:func:`PyMemoryView_FromMemory` or :c:func:`PyMemoryView_FromBuffer`.
|
||||
*mview* **must** be a memoryview instance.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue