@@ -135,6 +135,18 @@ class Packed3(Structure):
135135
136136@register ()
137137class Packed4 (Structure ):
138+ def _maybe_skip ():
139+ # `_pack_` enables MSVC-style packing, but keeps platform-specific
140+ # alignments.
141+ # The C code we generate for GCC/clang currently uses
142+ # `__attribute__((ms_struct))`, which activates MSVC layout *and*
143+ # alignments, that is, sizeof(basic type) == alignment(basic type).
144+ # On a Pentium, int64 is 32-bit aligned, so the two won't match.
145+ # The expected behavior is instead tested in
146+ # StructureTestCase.test_packed, over in test_structures.py.
147+ if sizeof (c_int64 ) != alignment (c_int64 ):
148+ raise unittest .SkipTest ('cannot test on this platform' )
149+
138150 _fields_ = [('a' , c_int8 ), ('b' , c_int64 )]
139151 _pack_ = 8
140152
@@ -436,6 +448,8 @@ def test_generated_data(self):
436448 """
437449 for name , cls in TESTCASES .items ():
438450 with self .subTest (name = name ):
451+ if _maybe_skip := getattr (cls , '_maybe_skip' , None ):
452+ _maybe_skip ()
439453 expected = iter (_ctypes_test .get_generated_test_data (name ))
440454 expected_name = next (expected )
441455 if expected_name is None :
0 commit comments