-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Doesn't correctly match overloads when calling method using conditional arguments #9264
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
Comments
I'm kind of surprised I can't seem to find other issues along these lines. mypy's joining Note https://github.com/python/mypy/wiki/Type-Checker seems to claim
but that's not a statement I immediately see the truth of. It's also possible that there's some ad hoc workaround involving type context. |
This definitely used to be a common feature request, but the core mypy team has always held that in many cases this would not be helpful. That's what that wiki page is trying to say. It's true that that is an intuition without data. But it's not cheap to test the alternative hypothesis, alas. We could ask @JukkaL if he has a specific argument, or if there is literature about this topic; and if he would object to a per-module (?) flag to change this. |
This is essentially the same as #5392. The main problem is that changing type inference would result a lot of work for existing users. Having a flag to switch between behaviors is a possibility and would allow existing users to continue using the old semantics. |
This bug appears to have been fixed at some point. I can no longer repro it with the latest version of mypy. |
I think underlying bug is still there and this was fixed by a change in typeshed types, but I'll take it |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
I am forced to replace it with
I would expect mypy to pass, as I believe the arguments passed to the bytearray constructor match the overloads.
Do you see the same issue after installing mypy from Git master?
mypy 0.782
master is the same
mypy --strict
The text was updated successfully, but these errors were encountered: