Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update ok comments
  • Loading branch information
ntBre committed Dec 2, 2025
commit 43f39bffafa98472c2e392e39e79905f1d2ce7d7
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ async def gen():
yield 1
return 42

def gen(): #ok
def gen(): # B901 but not a syntax error - not an async generator
yield 1
return 42

async def gen(): #ok
async def gen(): # ok - no value in return
yield 1
return

Expand All @@ -21,4 +21,4 @@ async def gen():
async def gen():
if True:
yield 1
return 10
return 10
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ B901 Using `yield` and `return {value}` in a generator function can lead to conf
3 | return 42
| ^^^^^^^^^
4 |
5 | def gen(): #ok
5 | def gen(): # B901 but not a syntax error - not an async generator
|

B901 Using `yield` and `return {value}` in a generator function can lead to confusing behavior
--> resources/test/fixtures/syntax_errors/return_in_generator.py:7:5
|
5 | def gen(): #ok
5 | def gen(): # B901 but not a syntax error - not an async generator
6 | yield 1
7 | return 42
| ^^^^^^^^^
8 |
9 | async def gen(): #ok
9 | async def gen(): # ok - no value in return
|

B901 Using `yield` and `return {value}` in a generator function can lead to confusing behavior
Expand Down