mypy suggests Iterator[Never]
, wants Iterator[None]
as return type of contextmanager
#18086
Labels
bug
mypy got something wrong
A superficial take on a context manager (https://mypy-play.net/?mypy=latest&python=3.12&gist=68fae9f1b14467dc3a586f2473c9c419):
results in:
If I specify
Iterator[Never]
as suggested, it still doesn't work (https://mypy-play.net/?mypy=latest&python=3.12&gist=d644d5c880c5f04b0c54941a7cc8c4b2):results in:
Inspired by #3551 I switched it to
None
(https://mypy-play.net/?mypy=latest&python=3.12&gist=e825ee207b3fbcad373163f5618f467e):And now it works:
How? Wasn't
Never
(as in "never returns") supposed to not ask for a return value?The text was updated successfully, but these errors were encountered: