Skip to content

Commit b9f54fb

Browse files
gh-156866: Document that pack_into() does not guarantee memory access shape
1 parent 369d8bc commit b9f54fb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎Doc/library/struct.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ The module defines the following exception and functions:
7070
position *offset*. Note that *offset* is a required argument.
7171
A negative *offset* counts from the end of *buffer*.
7272

73+
.. note::
74+
75+
``pack_into()`` specifies the packed bytes written to the buffer, but
76+
does not guarantee the number, width, or ordering of the underlying
77+
native memory accesses used to perform the write. In particular,
78+
writable buffers backed by memory-mapped I/O (MMIO) should not be
79+
treated as exact-width register access interfaces. Code that depends
80+
on exact MMIO access semantics should use an interface designed for
81+
that purpose and verify its behavior for the target implementation
82+
and platform.
83+
7384

7485
.. function:: unpack(format, buffer)
7586

0 commit comments

Comments
 (0)