-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
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
No error when importing typing.type_check_only
#11592
Comments
Can you please explain why do you think this should be an error? |
https://docs.python.org/3/library/typing.html#typing.type_check_only
It doesn't actually exist. > python test.py
Traceback (most recent call last):
File "/tmp/test.py", line 1, in <module>
from typing import type_check_only
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'type_check_only' from 'typing' (/usr/lib/python3.11/typing.py) |
We want things like this to be legal, though: from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import type_check_only This will not fail at runtime, so a blanket "mypy should raise an error if you ever try to import |
The docs specify that:
And if currently using it in a "runtime" context is a huge false negative, wouldn't it be better to always error when used in a py file (except for explicit |
related: #9531 |
Duplicate of #9531 |
Success: no issues found in 1 source file
The text was updated successfully, but these errors were encountered: