Skip to content

Mypy infers wrong type for -2 ** 0.5 #7046

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

Closed
JelleZijlstra opened this issue Jan 27, 2022 · 0 comments · Fixed by #7047
Closed

Mypy infers wrong type for -2 ** 0.5 #7046

JelleZijlstra opened this issue Jan 27, 2022 · 0 comments · Fixed by #7047

Comments

@JelleZijlstra
Copy link
Member

With current master of mypy and typeshed:

% mypy --custom-typeshed-dir . -c 'reveal_type((-2) ** 0.5)'
<string>:1: note: Revealed type is "builtins.float"

It's actually a complex.

This was brought up in python/mypy#12073 (comment) by @isaacto. cc @AlexWaygood who helped create our current stack of int.__pow__ overloads.

JelleZijlstra added a commit that referenced this issue Jan 27, 2022
hauntsaninja pushed a commit that referenced this issue Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant