Skip to content

Commit af33b09

Browse files
authored
Use __new__ for datetime.timedelta (#5532)
1 parent a32d24c commit af33b09

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

stdlib/@python2/datetime.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ class timedelta(SupportsAbs[timedelta]):
9999
min: ClassVar[timedelta]
100100
max: ClassVar[timedelta]
101101
resolution: ClassVar[timedelta]
102-
def __init__(
103-
self,
102+
def __new__(
103+
cls: Type[_S],
104104
days: float = ...,
105105
seconds: float = ...,
106106
microseconds: float = ...,
107107
milliseconds: float = ...,
108108
minutes: float = ...,
109109
hours: float = ...,
110110
weeks: float = ...,
111-
) -> None: ...
111+
) -> _S: ...
112112
@property
113113
def days(self) -> int: ...
114114
@property

stdlib/datetime.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,16 @@ class timedelta(SupportsAbs[timedelta]):
139139
min: ClassVar[timedelta]
140140
max: ClassVar[timedelta]
141141
resolution: ClassVar[timedelta]
142-
def __init__(
143-
self,
142+
def __new__(
143+
cls: Type[_S],
144144
days: float = ...,
145145
seconds: float = ...,
146146
microseconds: float = ...,
147147
milliseconds: float = ...,
148148
minutes: float = ...,
149149
hours: float = ...,
150150
weeks: float = ...,
151-
*,
152-
fold: int = ...,
153-
) -> None: ...
151+
) -> _S: ...
154152
@property
155153
def days(self) -> int: ...
156154
@property

0 commit comments

Comments
 (0)