Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Lib/test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

try:
import _testcapi
import _testlimitedcapi
except ImportError:
_testcapi = None

Expand Down Expand Up @@ -143,7 +144,7 @@ def native_type_range(fmt):
# Format codes supported by array.array
ARRAY = NATIVE.copy()
for k in NATIVE:
if not k in "bBhHiIlLfd":
if not k in list("bBhHiIlLefd") + ['Zf', 'Zd']:
del ARRAY[k]

BYTEFMT = NATIVE.copy()
Expand Down Expand Up @@ -4495,8 +4496,11 @@ def test_bytearray_alignment(self):
def test_array_alignment(self):
# gh-140557: pointer alignment of buffers including empty allocation
# should match the maximum array alignment.
align = max(struct.calcsize(fmt) for fmt in ARRAY)
cases = [array.array(fmt) for fmt in ARRAY]
MAX_ALIGN = _testlimitedcapi.ALIGNOF_MAX_ALIGN_T
align = max(struct.calcsize(fmt) for fmt in ARRAY
if struct.calcsize(fmt) <= MAX_ALIGN)
cases = [array.array(fmt) for fmt in ARRAY
if struct.calcsize(fmt) <= MAX_ALIGN]
# Empty arrays
self.assertEqual(
[_testcapi.buffer_pointer_as_int(case) % align for case in cases],
Expand Down
Loading