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

(🐞) no error with | operator on tuple and type #15756

Open
KotlinIsland opened this issue Jul 24, 2023 · 1 comment
Open

(🐞) no error with | operator on tuple and type #15756

KotlinIsland opened this issue Jul 24, 2023 · 1 comment
Labels
bug mypy got something wrong topic-pep-604 PEP 604 (union | operator) topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Jul 24, 2023

() | int  # no error
int | (int,)  # no error
@KotlinIsland KotlinIsland added the bug mypy got something wrong label Jul 24, 2023
@AlexWaygood AlexWaygood added topic-pep-604 PEP 604 (union | operator) topic-runtime-semantics mypy doesn't model runtime semantics correctly labels Jul 24, 2023
@erictraut
Copy link

Based on the type information in typeshed, mypy is correct to not generate an error here. That's because tuple includes a __ror__ method that has a parameter of type Any. It may be a reasonable enhancement request for mypy to override typeshed and special case these conditions, but I wouldn't consider this a bug.

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) topic-runtime-semantics mypy doesn't model runtime semantics correctly
Projects
None yet
Development

No branches or pull requests

3 participants