-
-
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
Adapt ast types for mypy 0.990 #9129
Comments
I'm not sure what you would want to change. Stubs don't use |
Ah sorry; so in my code I use code like Proposal: change |
FWIW I also think |
Okay, let me then give a PR a try |
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
Hm, as noticed in the PR, it looks like tpyeshed is using a flake8 lint rule that actually prohibits @srittau I would propose to disable this rule globally. |
I briefly scrolled through and found only other problematic annotations in typed-ast https://github.com/python/typeshed/blob/main/stubs/typed-ast/typed_ast/ast27.pyi#L241 and https://github.com/python/typeshed/blob/main/stubs/typed-ast/typed_ast/ast3.pyi#L260. @kasium maybe you can add these to your PR? |
sure! |
With mypy 0.990 the complex/int/float promotion was changed (see python/mypy#14030).
Therefore checks like
isinstance(node, ast.Num) and isinstance(node.n, int)
fails with strict mode enabled.The recommendation by mypy is to change complex to
Union[int, float, complex]
. Are there any objections to do so in the ast module?The text was updated successfully, but these errors were encountered: