| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
TBH I don't like this. This adds an even hackier hack on top of an existing hack.
Also maybe I am missing some context, but when was the last time some change was made in typeshed to accommodate mypy? Because what I constantly see is the opposite, we are adding some hacks and workarounds, because someone else wants to make changes in typeshed.
Sorry, something went wrong.
| UnionType.make_union(non_type_var_items), actual, direction | ||
| ) or infer_constraints(UnionType.make_union(type_var_items), actual, direction) | ||
| ret = infer_constraints(UnionType.make_union(non_type_var_items), actual, direction) | ||
| if ret or any(mypy.subtypes.is_subtype(t, actual) for t in non_type_var_items): |
There was a problem hiding this comment.
Using is_subtype() independently of direction is suspicious.
Sorry, something went wrong.
|
It's still pretty common for typeshed to do things because of mypy or to not even land changes in the first place that affect mypy output |
Sorry, something went wrong.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Sorry, something went wrong.
|
Regarding dict.__or__, this is likely due my PR: python/typeshed#14284 where some overloads were removed that purely existed in the first place to address quirks and ancient unresolved bugs in mypy (in particular, #3933 from 2017, #5874 from 2018). In fact, it seems that then and there the decision was made to instead of fixing this properly, to just add some overloads in typeshed:
But the presence of these overloads lead to downstream problems:
The best solution would be to fix #3933 / #5874, then I believe these hacks would no longer be necessary. I spend a whole lot of time/effort last year to make a patch (randolf-scholz#4), but I could never quite satisfy the whole test suite, and it appears that there are more underlying issues with mypy that need to be fixed first, such as bugs in *args handling (#20472 / #19651) and some weird behavior of literals in meets (#19560) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #21141
Can probably make this fix better, but it does the job