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
For loop with a Generator[Any, Any, NoReturn] doesn't cause unreachable code. #18891
fromtypingimportGenerator, NoReturndefgenerator() ->Generator[int, None, NoReturn]:
whileTrue:
yield1deffoo() ->int:
forxingenerator():
returnx# Code past this point should be unreachable.# But mypy expects a return statement here.
Expected Behavior
Any code following for loops that iterate over unending generators should be recognized as unreachable, and the execution shouldn't branch.
Activity