Skip to content
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

(🐞) | operator with _SpecialForm determined to be types.UnionType it's actually typing.Union #12369

Open
KotlinIsland opened this issue Mar 17, 2022 · 0 comments
Labels
bug mypy got something wrong topic-pep-604 PEP 604 (union | operator)

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Mar 17, 2022

from typing import Any

print(reveal_type(int | Any))  #  types.UnionType
> python test.py
typing.Union[int, typing.Any]

This causes issues with isinstance, despite the fact that isinstance can take a typing.Union.

from typing import Any

isinstance(1, str | Any)  # no error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-pep-604 PEP 604 (union | operator)
Projects
None yet
Development

No branches or pull requests

2 participants