@@ -135,6 +135,18 @@ class Packed3(Structure):
135
135
136
136
@register ()
137
137
class 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
+
138
150
_fields_ = [('a' , c_int8 ), ('b' , c_int64 )]
139
151
_pack_ = 8
140
152
@@ -436,6 +448,8 @@ def test_generated_data(self):
436
448
"""
437
449
for name , cls in TESTCASES .items ():
438
450
with self .subTest (name = name ):
451
+ if _maybe_skip := getattr (cls , '_maybe_skip' , None ):
452
+ _maybe_skip ()
439
453
expected = iter (_ctypes_test .get_generated_test_data (name ))
440
454
expected_name = next (expected )
441
455
if expected_name is None :
0 commit comments