diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index cf67751f8..493c4d088 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -41,6 +41,9 @@ class SupportsLenAndGetItem(Protocol[_T_co]): def __len__(self) -> int: ... def __getitem__(self, __k: int) -> _T_co: ... +class SupportsTrunc(Protocol): + def __trunc__(self) -> int: ... + # Mapping-like protocols # stable diff --git a/stdlib/math.pyi b/stdlib/math.pyi index 5a1e71a1c..1046676be 100644 --- a/stdlib/math.pyi +++ b/stdlib/math.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import SupportsTrunc from typing import Iterable, SupportsFloat, SupportsInt, Tuple, overload e: float @@ -94,7 +95,7 @@ def sinh(__x: SupportsFloat) -> float: ... def sqrt(__x: SupportsFloat) -> float: ... def tan(__x: SupportsFloat) -> float: ... def tanh(__x: SupportsFloat) -> float: ... -def trunc(__x: SupportsFloat) -> int: ... +def trunc(__x: SupportsTrunc) -> int: ... if sys.version_info >= (3, 9): def ulp(__x: SupportsFloat) -> float: ...