Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Currently, the overload order is:
Lines 319 to 323 in 40caa05
| ifsys.version_info>= (3, 8): | |
| @overload# type: ignore[override] | |
| def__sub__(self, __value: timedelta) ->Self: ... | |
| @overload | |
| def__sub__(self: _D, __value: _D) ->timedelta: ... |
However, both the c-module and the fallback pydatetime first check if other is a datetime:
def__sub__(self, other): "Subtract two datetimes, or a datetime and a timedelta."ifnotisinstance(other, datetime): ifisinstance(other, timedelta): returnself+-otherreturnNotImplementedSo shouldn't the overload order be vice versa?
Also, I noticed that at runtime, timedelta has __rdivmod__, __rmod__ and datetime has __rsub__, which are missing in the stub. But I guess this is because the pure python fallback doesn't have them.
Metadata
Metadata
Assignees
Labels
No labels