From f0bbc3bf2da639cefbc64b41780c882743ed32c4 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 4 Sep 2020 21:05:45 -0700 Subject: [PATCH] Add special case for integers raised to a power of 2 (#4473) --- stdlib/2/__builtin__.pyi | 3 +++ stdlib/2and3/builtins.pyi | 3 +++ 2 files changed, 6 insertions(+) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 50438cb1a..cad1c3ebf 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -220,6 +220,9 @@ class int: def __rtruediv__(self, x: int) -> float: ... def __rmod__(self, x: int) -> int: ... def __rdivmod__(self, x: int) -> Tuple[int, int]: ... + @overload + def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ... + @overload def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x. def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ... def __and__(self, n: int) -> int: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 50438cb1a..cad1c3ebf 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -220,6 +220,9 @@ class int: def __rtruediv__(self, x: int) -> float: ... def __rmod__(self, x: int) -> int: ... def __rdivmod__(self, x: int) -> Tuple[int, int]: ... + @overload + def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ... + @overload def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x. def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ... def __and__(self, n: int) -> int: ...