We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following snippet.
import contextlib import sys from typing import Iterator, NoReturn def foo() -> NoReturn: with bar(): pass sys.exit(0) @contextlib.contextmanager def bar() -> Iterator[None]: yield None
Running mypy produces
error: Implicit return in function which does not return [misc] def foo() -> NoReturn: ^
Hand-writing the context manager (as follows) does not produce the same error.
class Bar: def __enter__(self) -> None: return None def __exit__(self, *args: Any) -> None: pass
I think the error in the contextlib case is a false positive.
mypy version 0.761 and 0.770+dev.a07dbd00638c35729e30dfc4ae441a8985183563 (current master) Python version 3.6.9 flags --ignore-missing-imports --check-untyped-defs --disallow-untyped-defs --no-implicit-optional --warn-unused-ignores
0.761
0.770+dev.a07dbd00638c35729e30dfc4ae441a8985183563
3.6.9
--ignore-missing-imports --check-untyped-defs --disallow-untyped-defs --no-implicit-optional --warn-unused-ignores
May be related to #8129.
The text was updated successfully, but these errors were encountered:
Yes, moving the definition of bar() before definition of foo() fixes the error, which means this is a duplicate of #8129
bar()
foo()
Sorry, something went wrong.
No branches or pull requests
Consider the following snippet.
Running mypy produces
Hand-writing the context manager (as follows) does not produce the same error.
I think the error in the contextlib case is a false positive.
mypy version
0.761
and0.770+dev.a07dbd00638c35729e30dfc4ae441a8985183563
(current master)Python version
3.6.9
flags
--ignore-missing-imports --check-untyped-defs --disallow-untyped-defs --no-implicit-optional --warn-unused-ignores
May be related to #8129.
The text was updated successfully, but these errors were encountered: