Skip to content

Commit f0bbc3b

Browse files
authored
Add special case for integers raised to a power of 2 (#4473)
1 parent ea52d0b commit f0bbc3b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ class int:
220220
def __rtruediv__(self, x: int) -> float: ...
221221
def __rmod__(self, x: int) -> int: ...
222222
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
223+
@overload
224+
def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
225+
@overload
223226
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
224227
def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
225228
def __and__(self, n: int) -> int: ...

stdlib/2and3/builtins.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ class int:
220220
def __rtruediv__(self, x: int) -> float: ...
221221
def __rmod__(self, x: int) -> int: ...
222222
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
223+
@overload
224+
def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
225+
@overload
223226
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
224227
def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
225228
def __and__(self, n: int) -> int: ...

0 commit comments

Comments
 (0)