Skip to content

Commit 15393b2

Browse files
Apply ruff/pyupgrade rule UP028
UP028 Replace `yield` over `for` loop with `yield from`
1 parent b3361a5 commit 15393b2

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/cffi/model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ def enumfields(self, expand_anonymous_struct_union=True):
371371
if (name == '' and isinstance(type, StructOrUnion)
372372
and expand_anonymous_struct_union):
373373
# nested anonymous struct/union
374-
for result in type.enumfields():
375-
yield result
374+
yield from type.enumfields()
376375
else:
377376
yield (name, type, bitsize, quals)
378377

testing/cffi1/test_recompiler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,7 @@ def test_macro_var_callback():
12421242
#
12431243
values = ffi.new("int[50]")
12441244
def it():
1245-
for i in range(50):
1246-
yield i
1245+
yield from range(50)
12471246
it = it()
12481247
#
12491248
@ffi.callback("int *(*)(void)")

0 commit comments

Comments
 (0)