mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[3.12] gh-123609: Clarify usage of standalone PyBUF_FORMAT
(GH-123778) (GH-123904)
gh-123609: Clarify usage of standalone `PyBUF_FORMAT` (GH-123778)
(cherry picked from commit 962304a54c
)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
479e366ce3
commit
ce5bb3ca85
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue