Use __new__ for datetime.timedelta (#5532)

This commit is contained in:
scaramallion
2021-05-26 19:05:26 +10:00
committed by GitHub
parent a32d24cae0
commit af33b09bf6
2 changed files with 6 additions and 8 deletions

View File

@@ -139,8 +139,8 @@ class timedelta(SupportsAbs[timedelta]):
min: ClassVar[timedelta]
max: ClassVar[timedelta]
resolution: ClassVar[timedelta]
def __init__(
self,
def __new__(
cls: Type[_S],
days: float = ...,
seconds: float = ...,
microseconds: float = ...,
@@ -148,9 +148,7 @@ class timedelta(SupportsAbs[timedelta]):
minutes: float = ...,
hours: float = ...,
weeks: float = ...,
*,
fold: int = ...,
) -> None: ...
) -> _S: ...
@property
def days(self) -> int: ...
@property