-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Unintended consequences of eliminating promotions with isinstance? #6180
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
And, this is a regression---albeit a false negative regression. It might be worth thinking about before the release (#6130) |
(Thoughts, @Michael0x2a ?) |
Honestly, at this stage, I think we should just revert the pull request I made and re-open #6060. I think it's pretty clear this has more ramifications then intended, and it doesn't seem like the original issue is really that glaring of an issue anyways. We can then look into landing a more targeted and less disruptive fix after the release. Really, the only reason why I went ahead and landed this was because it didn't seem to make a difference when I tried testing that fix internally -- but clearly, I messed up some part of that process. |
That sounds reasonable to me |
This pull request reverts python#6114 and python#6142: see python#6180 for rationale. In short, the original fix ended up being more disruptive then anticipated: it's modifying str and unicode semantics, and we should put a little more thought into reasoning about that particular case before moving ahead with any fix here. This should also help unblock the upcoming 0.660 release.
This pull request reverts #6114 and #6142: see #6180 for rationale. In short, the original fix ended up being more disruptive then anticipated: it's modifying str and unicode semantics, and we should put a little more thought into reasoning about that particular case before moving ahead with any fix here. This should also help unblock the upcoming 0.660 release.
Previously, the following code:
would emit the expected types (str, unicode) in each branch
Post #6114, which removed the use of promotions when doing isinstance,
it only emits that the type is unicode and skips checking the first branch.
Is this bad? Should we be doing something else? Obviously str is not really a subtype of unicode, but there are a lot of places where things declared unicode can actually be str.
I think the intention with the first fix was to mostly to fix Union-related issues, so maybe we need a special case for non-unions? Argh.
Thoughts?
The text was updated successfully, but these errors were encountered: