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
intentionally empty generator marked as unreachable #15345
I'm not sure -- I think the only case is specifically the one in the issue -- I can't think of others since if it were conditional then there'd probably be a yield in the other arm. maybe this is specifically a cutout for return; yield as the total body?
Activity
Hayashi-Yudai commentedon Jun 2, 2023
Uum... I couldn't reproduce this bug.
--warn-unreachableflagmypy.iniasottile commentedon Jun 2, 2023
yes you've used the workaround.
ikonst commentedon Jun 2, 2023
What could be a good heuristic here? That an empty yield statement (without expression) is explicitly allowed to trail a return statement?
asottile commentedon Jun 2, 2023
I'm not sure -- I think the only case is specifically the one in the issue -- I can't think of others since if it were conditional then there'd probably be a yield in the other arm. maybe this is specifically a cutout for
return; yieldas the total body?ikonst commentedon Jun 2, 2023
How about every function having a budget for one bare yield that doesn't get flagged?
ikonst commentedon Jun 7, 2023
Planning to address it on top of #15386.