]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-140557: Force alignment of empty `bytearray` and `array.array` buffers (GH-140559)
authorJake Lishman <jake@binhbar.com>
Mon, 26 Jan 2026 15:45:17 +0000 (15:45 +0000)
committerGitHub <noreply@github.com>
Mon, 26 Jan 2026 15:45:17 +0000 (16:45 +0100)
commit19de10d3d8605a290492e4fb3871e12638b0f7bb
tree6fbee2a009b50859e156e0fa4c3204a028d7cbc8
parent1f55caf97e0906f2b8b693b01d3d6073df8187c1
gh-140557: Force alignment of empty `bytearray` and `array.array` buffers (GH-140559)

This ensures the buffers used by the empty `bytearray` and `array.array`
are aligned the same as a pointer returned by the allocator.  This is a
more convenient default for interop with other languages that have
stricter requirements of type-safe buffers (e.g. Rust's `&[T]` type)
even when empty.
Lib/test/test_buffer.py
Misc/ACKS
Misc/NEWS.d/next/Core_and_Builtins/2025-10-24-17-30-51.gh-issue-140557.X2GETk.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2026-01-07-11-57-59.gh-issue-140557.3P6-nW.rst [new file with mode: 0644]
Modules/_testcapi/buffer.c
Modules/arraymodule.c