8000 [3.13] gh-123609: Clarify usage of standalone `PyBUF_FORMAT` (GH-123778) by miss-islington · Pull Request #123903 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-123609: Clarify usag 8000 e of standalone PyBUF_FORMAT (GH-123778) #123903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Hide whitespace
Diff view
gh-123609: Clarify usage of standalone PyBUF_FORMAT (GH-123778)
(cherry picked from commit 962304a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
  • Loading branch information
ZeroIntensity authored and miss-islington committed Sep 10, 2024
commit 2a571da64a543c1f618bf7c19a9d82f55fe1aaba
9 changes: 5 additions & 4 deletions Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ The following fields are not influenced by *flags* and must always be filled in
with the correct values: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`,
:c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`.


readonly, format
~~~~~~~~~~~~~~~~

Expand All @@ -253,7 +252,8 @@ readonly, format
Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter
MUST provide a writable buffer or else report failure. Otherwise, the
exporter MAY provide either a read-only or writable buffer, but the choice
MUST be consistent for all consumers.
MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE`
can be used to request a simple writable buffer.

.. c:macro:: PyBUF_FORMAT

Expand All @@ -265,8 +265,9 @@ readonly, format
Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:`PyBUF_WRITABLE`
can be used as a stand-alone flag to request a simple writable buffer.

:c:macro:`PyBUF_FORMAT` can be \|'d to any of the flags except :c:macro:`PyBUF_SIMPLE`.
The latter already implies format ``B`` (unsigned bytes).
:c:macro:`PyBUF_FORMAT` must be \|'d to any of the flags except :c:macro:`PyBUF_SIMPLE`, because
the latter already implies format ``B`` (unsigned bytes). :c:macro:`!PyBUF_FORMAT` cannot be
used on its own.


shape, strides, suboffsets
Expand Down
Loading
0