mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #11576: Fixed timedelta subtraction glitch on big timedelta values
This commit is contained in:
parent
04026cf56c
commit
b6f5ec7370
3 changed files with 19 additions and 8 deletions
|
@ -485,7 +485,11 @@ class timedelta:
|
|||
|
||||
def __sub__(self, other):
|
||||
if isinstance(other, timedelta):
|
||||
return self + -other
|
||||
# for CPython compatibility, we cannot use
|
||||
# our __class__ here, but need a real timedelta
|
||||
return timedelta(self._days - other._days,
|
||||
self._seconds - other._seconds,
|
||||
self._microseconds - other._microseconds)
|
||||
return NotImplemented
|
||||
|
||||
def __rsub__(self, other):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue