https://github.com/python/cpython/commit/13c9fa3d64e0653d696daad716703ef05fd5002b
commit: 13c9fa3d64e0653d696daad716703ef05fd5002b
branch: main
author: Petr Viktorin <[email protected]>
committer: zware <[email protected]>
date: 2024-10-23T16:37:06-05:00
summary:
gh-121938: ctypes: Skip test of _pack_-ed struct with c_int64 on x86 (GH-125877)
The current auto-generated tests don't cover this; it's instead
tested manually.
files:
M Lib/test/test_ctypes/test_generated_structs.py
diff --git a/Lib/test/test_ctypes/test_generated_structs.py
b/Lib/test/test_ctypes/test_generated_structs.py
index cbd73c4e911e4e..d61754d6d49e70 100644
--- a/Lib/test/test_ctypes/test_generated_structs.py
+++ b/Lib/test/test_ctypes/test_generated_structs.py
@@ -135,6 +135,18 @@ class Packed3(Structure):
@register()
class Packed4(Structure):
+ def _maybe_skip():
+ # `_pack_` enables MSVC-style packing, but keeps platform-specific
+ # alignments.
+ # The C code we generate for GCC/clang currently uses
+ # `__attribute__((ms_struct))`, which activates MSVC layout *and*
+ # alignments, that is, sizeof(basic type) == alignment(basic type).
+ # On a Pentium, int64 is 32-bit aligned, so the two won't match.
+ # The expected behavior is instead tested in
+ # StructureTestCase.test_packed, over in test_structures.py.
+ if sizeof(c_int64) != alignment(c_int64):
+ raise unittest.SkipTest('cannot test on this platform')
+
_fields_ = [('a', c_int8), ('b', c_int64)]
_pack_ = 8
@@ -436,6 +448,8 @@ def test_generated_data(self):
"""
for name, cls in TESTCASES.items():
with self.subTest(name=name):
+ if _maybe_skip := getattr(cls, '_maybe_skip', None):
+ _maybe_skip()
expected = iter(_ctypes_test.get_generated_test_data(name))
expected_name = next(expected)
if expected_name is None:
_______________________________________________
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]