You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Syntax errors in async generators aren't reported in unreachable code #5750
asyncdefreturn_value():
yield1returnreturn42# SyntaxError: 'return' with value in async generatorasyncdefyield_from():
returnyieldfrom [1] # SyntaxError: 'yield from' inside async function
Pyrefly reports nothing here, even though there are runtime issues
(scratch) mgorelli@marcoslaptop:~/scratch$ mypy t.pyt.py:8: error: "yield from" in async functionFound 1 error in 1 file (errors prevented further checking)(scratch) mgorelli@marcoslaptop:~/scratch$ ty check t.pyerror[invalid-syntax]: `return` with value in async generator --> t.py:4:5 |4 | return 42 # SyntaxError: 'return' with value in async generator | ^^^^^^^^^error[invalid-syntax]: `yield from` statement in async function; use `async for` instead --> t.py:8:5 |8 | yield from [1] # SyntaxError: 'yield from' inside async function | ^^^^^^^^^^^^^^Found 2 diagnostics(scratch) mgorelli@marcoslaptop:~/scratch$ pyrefly check t.py INFO 0 errors
Activity
stroxler commentedon Nov 24, 2026
Do you want to take this, since it overlaps with #5678 (and I think to some of my concerns on that change)?
MarcoGorelli commentedon Nov 24, 2026
i'm going to be short on time this week, so feel free to take it (else i'll try to get back to it next week)
stroxler commentedon Nov 24, 2026
I'll be short on time too, so it's yours :) I don't think there's any huge rush, especially given this is a holiday week in the US
Feel free to un-assign if you decide you don't have time but I think it makes sense given the open PR. Thanks!