From 041a6dc4b9917779f90d9a56c1452512c76d2520 Mon Sep 17 00:00:00 2001 From: arcanescaper Date: Wed, 24 Jun 2026 22:02:08 +0300 Subject: [PATCH 1/5] Fix incorrect and missing docstrings in pybuffer.h --- Include/pybuffer.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Include/pybuffer.h b/Include/pybuffer.h index 6371b9b483777ba..d3880e0f44d124b 100644 --- a/Include/pybuffer.h +++ b/Include/pybuffer.h @@ -54,10 +54,17 @@ PyAPI_FUNC(void *) PyBuffer_GetPointer(const Py_buffer *view, const Py_ssize_t * struct-style description. */ PyAPI_FUNC(Py_ssize_t) PyBuffer_SizeFromFormat(const char *format); -/* Implementation in memoryobject.c */ +/* Copy 'len' bytes from 'src' to its contiguous representation in 'buf'. + + Returns 0 on success and -1 on error; fails if len != src->len. + Implementation in memoryobject.c */ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, const Py_buffer *view, Py_ssize_t len, char order); +/* Copy contiguous 'len' bytes from 'buf' to 'view'. + 'fort' can be 'C' or 'F' (for C-style or Fortran-style ordering). + + Returns 0 on success and -1 on error. */ PyAPI_FUNC(int) PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char order); @@ -76,10 +83,14 @@ PyAPI_FUNC(int) PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, in whatever way is more efficient. */ PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); -/* Copy the data from the src buffer to the buffer of destination. */ +/* Check if the memory defined by the 'view' is contiguous. + Possible contiguous style defined in 'order' are `C`, `F` or `A`. + That means C-style, Fortran-style or Any of them, respectively. + + Returns 1 on success and 0 otherwise, without raising an error. */ PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char order); -/*Fill the strides array with byte-strides of a contiguous +/* Fill the strides array with byte-strides of a contiguous (Fortran-style if order is 'F' or C-style otherwise) array of the given shape with the given number of bytes per element. */ From 7c4570e6fe34bdc942d5c4621da4c11273c7e988 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 17:35:00 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst diff --git a/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst b/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst new file mode 100644 index 000000000000000..e3429964e1b1705 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst @@ -0,0 +1 @@ +Corrected and clarified the documentation comments for several PyBuffer_* C API functions in Include/pybuffer.h, including the description of PyBuffer_IsContiguous(). From 23f5faf7fc43f4d53b9ec2790c2efdf0c3caf529 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 17:38:52 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst diff --git a/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst b/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst new file mode 100644 index 000000000000000..e3429964e1b1705 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst @@ -0,0 +1 @@ +Corrected and clarified the documentation comments for several PyBuffer_* C API functions in Include/pybuffer.h, including the description of PyBuffer_IsContiguous(). From dded7b0d3e49061ab2378d380024b68d397a84e0 Mon Sep 17 00:00:00 2001 From: arcanescaper Date: Sun, 12 Jul 2026 20:42:24 +0300 Subject: [PATCH 4/5] Delete Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst --- .../next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst diff --git a/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst b/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst deleted file mode 100644 index e3429964e1b1705..000000000000000 --- a/Misc/NEWS.d/next/Documentation/2026-07-12-17-34-58.gh-issue--.i6abSm.rst +++ /dev/null @@ -1 +0,0 @@ -Corrected and clarified the documentation comments for several PyBuffer_* C API functions in Include/pybuffer.h, including the description of PyBuffer_IsContiguous(). From a57d74569900da90d7d9de92ac74fc0acd189a91 Mon Sep 17 00:00:00 2001 From: arcanescaper Date: Sun, 12 Jul 2026 20:47:45 +0300 Subject: [PATCH 5/5] Delete Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst --- .../next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst diff --git a/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst b/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst deleted file mode 100644 index e3429964e1b1705..000000000000000 --- a/Misc/NEWS.d/next/Documentation/2026-07-12-17-38-50.gh-issue-0.i6abSm.rst +++ /dev/null @@ -1 +0,0 @@ -Corrected and clarified the documentation comments for several PyBuffer_* C API functions in Include/pybuffer.h, including the description of PyBuffer_IsContiguous().