-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Improve ast
types; revert several "redundant numeric union" changes from #7906
#9130
Conversation
Since mypy 0.990 type promotions was limited. This means that complex is not longer promoted to int/float, therefore we should adapt the types to list all possible types Closes python#9129
Mypy flake8 doesn't like it
|
This comment has been minimized.
This comment has been minimized.
Well I guess we can exclude |
@ilevkivskyi I added a noqa for now and opened an issue at flake8-pyi |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I'd like to discuss this a little more before we go ahead with this. We may want to do a complete revert of #7906 if we need to go down this route.
This comment has been minimized.
This comment has been minimized.
I don't think we need to do a full revert. It needs to be decided on case by case basis. For example, in function argument types using promotions is OK (unless function behaves differently for |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to stubs look good!
Hi, |
Hi @kasium! The discussion in the mypy issue means that it looks like the behaviour change in mypy is about to be (partially) reverted: python/mypy#14077. So I don't think there's a massive rush to get this merged :) Having said that, I'm happy for the changes to the I'd rather fix flake8-pyi first, however, so that it only emits Y041 for parameter annotations. Then we won't need to switch off Y041 in typeshed's |
I've asked if there's any chance of getting a mypy patch release with python/mypy#14077 included: python/mypy#13871 (comment). |
Update: mypy doesn't want to include python/mypy#14077 in a patch release. So let's merge this as a quick fix. |
ast
types; revert several "redundant numeric union" changes from #7906
Diff from mypy_primer, showing the effect of this PR on open source code: flake8-pyi (https://github.com/PyCQA/flake8-pyi)
- pyi.py:1126: error: Subclass of "complex" and "int" cannot exist: would have incompatible method signatures [unreachable]
- pyi.py:1275: error: Subclass of "complex" and "int" cannot exist: would have incompatible method signatures [unreachable]
- pyi.py:1275: error: Right operand of "and" is never evaluated [unreachable]
- pyi.py:1276: error: Statement is unreachable [unreachable]
- pyi.py:1287: error: Subclass of "complex" and "int" cannot exist: would have incompatible method signatures [unreachable]
- pyi.py:1288: error: Right operand of "and" is never evaluated [unreachable]
- pyi.py:1290: error: Statement is unreachable [unreachable]
- pyi.py:1313: error: Subclass of "complex" and "int" cannot exist: would have incompatible method signatures [unreachable]
|
Thanks for the PR @kasium! |
Thanks for the fast work! |
improve ast types; revert several "redundant numeric union" changes from #7906 see python/typeshed#9130
@kasium — looks like the |
Since mypy 0.990 type promotions was limited.
This means that complex is not longer promoted to int/float, therefore we should adapt the types to list all possible types
Closes #9129