[Python-checkins] bpo-33126: Document PyBuffer_ToContiguous() (GH-6292) (GH-6294)

Antoine Pitrou webhook-mailer at python.org
Wed Mar 28 11:50:27 EDT 2018

commit: 6124d8ec0d1eb8016e5e54a4d341b8f4f995623c
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Antoine Pitrou <pitrou at free.fr>
date: 2018-03-28T17:50:24+02:00

bpo-33126: Document PyBuffer_ToContiguous() (GH-6292) (GH-6294)

(cherry picked from commit aa50bf08e64f49d57917ab0b1aadf4308a3168a6)

Co-authored-by: Antoine Pitrou <pitrou at free.fr>

A Misc/NEWS.d/next/Documentation/2018-03-28-17-03-17.bpo-33126.5UGkNv.rst
M Doc/c-api/buffer.rst

diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst
index 8c2de9691f3e..5a9a46fc67e8 100644
--- a/Doc/c-api/buffer.rst
+++ b/Doc/c-api/buffer.rst
@@ -473,6 +473,15 @@ Buffer-related functions
    (*order* is ``'A'``).  Return ``0`` otherwise.
+.. c:function:: int PyBuffer_ToContiguous(void *buf, 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'`` (for C-style or Fortran-style ordering).
+   ``0`` is returned on success, ``-1`` on error.
+   This function fails if *len* != *src->len*.
 .. c:function:: void PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char order)
    Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style if
@@ -497,6 +506,3 @@ Buffer-related functions
    If this function is used as part of a :ref:`getbufferproc <buffer-structs>`,
    *exporter* MUST be set to the exporting object and *flags* must be passed
    unmodified. Otherwise, *exporter* MUST be NULL.
diff --git a/Misc/NEWS.d/next/Documentation/2018-03-28-17-03-17.bpo-33126.5UGkNv.rst b/Misc/NEWS.d/next/Documentation/2018-03-28-17-03-17.bpo-33126.5UGkNv.rst
new file mode 100644
index 000000000000..1219790e79ec
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2018-03-28-17-03-17.bpo-33126.5UGkNv.rst
@@ -0,0 +1 @@
+Document PyBuffer_ToContiguous().

More information about the Python-checkins mailing list