From b9f54fb6901237900922d80efd6923edc35a613e Mon Sep 17 00:00:00 2001 From: Jayant Dubey <271153438+themythofsisyphusjayant@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:38:37 +0530 Subject: [PATCH] gh-156866: Document that pack_into() does not guarantee memory access shape --- Doc/library/struct.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 07e4c82375fc1ee..4b837a1698f8604 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -70,6 +70,17 @@ The module defines the following exception and functions: position *offset*. Note that *offset* is a required argument. A negative *offset* counts from the end of *buffer*. + .. note:: + + ``pack_into()`` specifies the packed bytes written to the buffer, but + does not guarantee the number, width, or ordering of the underlying + native memory accesses used to perform the write. In particular, + writable buffers backed by memory-mapped I/O (MMIO) should not be + treated as exact-width register access interfaces. Code that depends + on exact MMIO access semantics should use an interface designed for + that purpose and verify its behavior for the target implementation + and platform. + .. function:: unpack(format, buffer)