Skip to content

gh-148431: Clarify format and item size in buffer requests - #159832

Open
limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-148431-buffer-format-docs
Open

limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-148431-buffer-format-docs

Conversation

@limadog9

@limadog9 limadog9 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #148431.

Clarify that a NULL Py_buffer.format does not imply that the original elements have size one when shape information is present. Explain that PyBUF_FORMAT is optional for structured requests and must be combined with PyBUF_ND or a flag that includes it, rather than used alone or only with PyBUF_WRITABLE.

Validation: the full Sphinx HTML build passed with warnings treated as errors; sphinx-lint and git diff --check passed. Verified the described behavior with a non-byte memoryview and _testbuffer.ndarray, covering PyBUF_ND, PyBUF_STRIDED_RO, PyBUF_SIMPLE, and format requests with and without shape information.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35258028 | 📁 Comparing 9c8ed60 against main (0fba211)

  🔍 Preview build  

1 file changed
± c-api/buffer.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Buffer requests - itemsize, format, and PyBUF_SIMPLE

1 participant