Skip to content

Commit 9cf18cd

Browse files
committed
Remove unused last_field
1 parent b387d30 commit 9cf18cd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Lib/ctypes/_layout.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def get_layout(cls, input_fields, is_struct, base):
160160
next_byte_offset = struct_size
161161

162162
last_size = struct_size
163-
last_field = None
164163
for i, field in enumerate(input_fields):
165164
if not is_struct:
166165
# Unions start fresh each time
@@ -292,18 +291,17 @@ def get_layout(cls, input_fields, is_struct, base):
292291
"field {name!r}: name must be a string, not bytes")
293292
format_spec_parts.append(f"{fieldfmt}:{name}:")
294293

295-
last_field = CField(
294+
result_fields.append(CField(
296295
name=name,
297296
type=ctype,
298297
size=size,
299298
offset=offset,
300299
bit_size=bit_size if is_bitfield else None,
301300
index=i,
302-
)
301+
))
303302
if is_bitfield and not gcc_layout:
304303
assert type_bit_size > 0
305304

306-
result_fields.append(last_field)
307305
align = max(align, type_align)
308306
last_size = struct_size
309307
if not is_struct:

0 commit comments

Comments
 (0)