From b0f4900c9fbf5092ee40936f0b831641d6f49e03 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 22 Oct 2020 12:12:27 -0700 Subject: [PATCH] fractions: make Fraction satisfy SupportsRound (#4697) Helps with https://github.com/python/mypy/issues/9628 Co-authored-by: hauntsaninja <> --- stdlib/2and3/fractions.pyi | 4 ++-- stdlib/2and3/numbers.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/2and3/fractions.pyi b/stdlib/2and3/fractions.pyi index 355489bc6..771868e0a 100644 --- a/stdlib/2and3/fractions.pyi +++ b/stdlib/2and3/fractions.pyi @@ -143,9 +143,9 @@ class Fraction(Rational): def __floor__(self) -> int: ... def __ceil__(self) -> int: ... @overload - def __round__(self, ndigits: int) -> Fraction: ... - @overload def __round__(self, ndigits: None = ...) -> int: ... + @overload + def __round__(self, ndigits: int) -> Fraction: ... def __hash__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __lt__(self, other: _ComparableNum) -> bool: ... diff --git a/stdlib/2and3/numbers.pyi b/stdlib/2and3/numbers.pyi index ccbc1cc23..6a2290048 100644 --- a/stdlib/2and3/numbers.pyi +++ b/stdlib/2and3/numbers.pyi @@ -71,10 +71,10 @@ class Real(Complex, SupportsFloat): def __ceil__(self) -> int: ... @abstractmethod @overload - def __round__(self, ndigits: int) -> Any: ... + def __round__(self, ndigits: None = ...) -> int: ... @abstractmethod @overload - def __round__(self, ndigits: None = ...) -> int: ... + def __round__(self, ndigits: int) -> Any: ... def __divmod__(self, other: Any) -> Any: ... def __rdivmod__(self, other: Any) -> Any: ... @abstractmethod