Remove NoReturn overloads from pow() (#8568)

This commit is contained in:
Alex Waygood
2022-08-19 20:15:07 +02:00
committed by GitHub
parent 0428069fab
commit 8a326dc9ec
2 changed files with 8 additions and 8 deletions

View File

@@ -266,8 +266,6 @@ class int:
@overload
def __pow__(self, __x: int, __modulo: None = ...) -> Any: ...
@overload
def __pow__(self, __x: int, __modulo: Literal[0]) -> NoReturn: ...
@overload
def __pow__(self, __x: int, __modulo: int) -> int: ...
def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ...
def __and__(self, __n: int) -> int: ...
@@ -1548,8 +1546,8 @@ _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs a
)
if sys.version_info >= (3, 8):
@overload
def pow(base: int, exp: int, mod: Literal[0]) -> NoReturn: ...
# TODO: `pow(int, int, Literal[0])` fails at runtime,
# but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566).
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
@@ -1587,8 +1585,6 @@ if sys.version_info >= (3, 8):
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = ...) -> complex: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: Literal[0]) -> NoReturn: ...
@overload
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload