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

isinstance(x, CallableType) and x.is_type_object() is a code smell #12320

Open
hauntsaninja opened this issue Mar 9, 2022 · 0 comments
Open
Labels
bug mypy got something wrong refactoring Changing mypy's internals topic-developer Issues relevant to mypy developers

Comments

@hauntsaninja
Copy link
Collaborator

While fixing #12319 I noticed that if you grep for is_type_object, there are several instances where only CallableTypes are handled. Presumably, these all do the wrong thing for types with overloaded __new__.

@hauntsaninja hauntsaninja added the bug mypy got something wrong label Mar 9, 2022
@JelleZijlstra JelleZijlstra added the refactoring Changing mypy's internals label Mar 19, 2022
@AlexWaygood AlexWaygood added the topic-developer Issues relevant to mypy developers label Mar 24, 2022
hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Sep 23, 2023
Fixes most of python#12320. I didn't add tests for every code path because
it's niche. I also didn't fix everything, in particular the cases where
we proceed to use `ret_type`, or ones I thought were scary
hauntsaninja added a commit that referenced this issue Oct 1, 2023
Fixes most of #12320. I didn't add tests for every code path because
it's niche. I also didn't fix everything, in particular the cases where
we proceed to use `ret_type`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong refactoring Changing mypy's internals topic-developer Issues relevant to mypy developers
Projects
None yet
Development

No branches or pull requests

3 participants