Skip to content

gh-156866: Document that pack_into() does not guarantee memory access shape - #157052

Open
lazerg wants to merge 1 commit into
python:mainfrom
lazerg:gh-156866-struct-mmio-doc
Open

gh-156866: Document that pack_into() does not guarantee memory access shape#157052
lazerg wants to merge 1 commit into
python:mainfrom
lazerg:gh-156866-struct-mmio-doc

Conversation

@lazerg

@lazerg lazerg commented Sep 6, 2026

Copy link
Copy Markdown

struct.pack_into() only documents which bytes end up in the buffer, not how the write happens underneath. On ordinary memory that distinction never matters, but on a buffer backed by memory-mapped I/O the number, width, and ordering of the actual stores can be significant, and a single pack_into() call isn't guaranteed to turn into one native store. This adds a short note to that effect so nobody assumes pack_into() is a register-width MMIO write primitive.

Fixes #156866

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34422231 | 📁 Comparing e0a428d against main (09117bc)

  🔍 Preview build  

1 file changed
± library/struct.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.

Documentation: clarify that struct.pack_into() does not guarantee exact memory-access semantics

1 participant