-
-
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
Union between a callable and a type not respected by functools.partial #17741
Comments
This is sort of underlying behaviour in mypy that is exposed now that mypy checks functools.partial E.g. on mypy 1.11 both of these will complain
This could be fixed by improving the join logic (improving callable joins would fix many existing mypy issues) or potentially by changing the functools.partial logic to avoid using joins on unions (this could get messy) |
Thanks! I've tested mypy from git and there is one less error report now when upgrading mypy (and looks like the others are all either our fault, unused "type: ignore", or a renamed error code). <3 |
Seems similar to #17646 but not fixed in https://mypy-play.net/?mypy=master&python=3.12
The linked #17659 is not applicable because I am not using Self.
Sample code:
Error:
The codebase where this was discovered: https://github.com/mesonbuild/meson/blob/83f8de5357f31d6448ae033e1e8ed2b22c8c306a/mesonbuild/dependencies/factory.py#L75-L95
Both sides of the union if cast and used independently, work.
The text was updated successfully, but these errors were encountered: