Skip to content

Commit e260051

Browse files
authored
gh-104533: Fix @ctypes.util.struct with endian (#154038)
Change `_fields_` type to a list of tuples, instead of a list of lists. Modify test.test_ctypes.test_aligned_structures to test also `@ctypes.util.struct` decorator.
1 parent 8367448 commit e260051

2 files changed

Lines changed: 293 additions & 139 deletions

File tree

Lib/ctypes/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ def _process_struct(decorated_class, /, *, align, layout, endian, pack):
532532
else:
533533
field.append(hint)
534534

535-
fields.append(field)
535+
# _fields_ is a list of tuples
536+
fields.append(tuple(field))
536537

537538
if endian == 'big':
538539
endian_class = BigEndianStructure

0 commit comments

Comments
 (0)