https://github.com/python/cpython/commit/ffa4d47abdbf38bb5d022d2e37949226cdff7198
commit: ffa4d47abdbf38bb5d022d2e37949226cdff7198
branch: main
author: Sergey B Kirpichev <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-06T15:14:49+02:00
summary:

gh-146238: Add missing tests for 'e', 'Zf' and 'Zd' array type codes in 
test_buffer (#149345)

This amends e79fd60.  I'll not fix this for 'F'/'D' complex types as
they might be removed.

files:
M Lib/test/test_buffer.py

diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index f08faa14b24c64..7454c8a15391e9 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -143,7 +143,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 k not in list("bBhHiIlLefd") + ['Zf', 'Zd']:
         del ARRAY[k]
 
 BYTEFMT = NATIVE.copy()
@@ -4495,8 +4495,10 @@ 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]
+        formats = [fmt for fmt in ARRAY
+                   if struct.calcsize(fmt) <= struct.calcsize('P')]
+        align = max(struct.calcsize(fmt) for fmt in formats)
+        cases = [array.array(fmt) for fmt in formats]
         # Empty arrays
         self.assertEqual(
             [_testcapi.buffer_pointer_as_int(case) % align for case in cases],

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to