Skip to content

Loosen __pow__ overloads a bit #7682

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
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ class int:
@overload
def __pow__(self, __x: _NegativeInteger, __modulo: None = ...) -> float: ...
# positive x -> int; negative x -> float
# return type must be Any as `int | float` causes too many false-positive errors
# return type is `int | float | Any` as `int | float` causes too many false-positive errors
@overload
def __pow__(self, __x: int, __modulo: None = ...) -> Any: ...
def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ...
def __pow__(self, __x: int, __modulo: None = ...) -> int | float | Any: ...
def __rpow__(self, __x: int, __mod: int | None = ...) -> int | float | Any: ...
def __and__(self, __n: int) -> int: ...
def __or__(self, __n: int) -> int: ...
def __xor__(self, __n: int) -> int: ...
Expand Down Expand Up @@ -318,9 +318,9 @@ class float:
@overload
def __pow__(self, __x: int, __mod: None = ...) -> float: ...
# positive x -> float; negative x -> complex
# return type must be Any as `float | complex` causes too many false-positive errors
# return type is `float | complex | Any` as `float | complex` causes too many false-positive errors
@overload
def __pow__(self, __x: float, __mod: None = ...) -> Any: ...
def __pow__(self, __x: float, __mod: None = ...) -> float | complex | Any: ...
def __radd__(self, __x: float) -> float: ...
def __rsub__(self, __x: float) -> float: ...
def __rmul__(self, __x: float) -> float: ...
Expand All @@ -329,7 +329,7 @@ class float:
def __rmod__(self, __x: float) -> float: ...
def __rdivmod__(self, __x: float) -> tuple[float, float]: ...
# Returns complex if the argument is negative.
def __rpow__(self, __x: float, __mod: None = ...) -> Any: ...
def __rpow__(self, __x: float, __mod: None = ...) -> float | complex | Any: ...
def __getnewargs__(self) -> tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3, 9):
Expand Down