Repository navigation
builtins.pyi: Return complex from __(r)pow__() - #2662
Conversation
ff94bf6 to
7ac2fec
Compare
| def __mod__(self, x: float) -> float: ... | ||
| def __divmod__(self, x: float) -> Tuple[float, float]: ... | ||
| def __pow__(self, x: float) -> float: ... | ||
| def __pow__(self, x: float) -> complex: ... |
There was a problem hiding this comment.
This should have an overload for when x is an int, since it will never be complex in that case. See #2444 for an example. Apart from that this PR looks good to me.
There was a problem hiding this comment.
Why is the CI failing now, @srittau? 😅
Would it be complex, instead of float?
There was a problem hiding this comment.
It fails in mypy's test suite. It's likely the test suite needs to be adopted. I will have a closer look tomorrow.
There was a problem hiding this comment.
Yeah, sure.
Didn't quite get it.
This is necessary due to python/typeshed#2662, where float.__pow__() now returns complex in the general case.
|
I started a discussion about the build failure in #1406. |
This add a comment to the __pow__() function. Fixes python#1406
Done as asked. |
|
Thank you for your persistence! |

This returns
complex, instead offloat.Fixes #1406