Allow math.trunc to only accept __trunc__-supporting objects (#6003)

Add SupportsTrunc protocol
This commit is contained in:
Bas van Beek
2021-09-04 18:16:53 +02:00
committed by GitHub
parent 3819f8e6ff
commit d599a535b2
2 changed files with 5 additions and 1 deletions

View File

@@ -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: ...