diff options
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r-- | Lib/datetime.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py index 4780b6df8f..89c32c0b0a 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1014,7 +1014,7 @@ class date: if isinstance(other, timedelta): o = self.toordinal() + other.days if 0 < o <= _MAXORDINAL: - return date.fromordinal(o) + return type(self).fromordinal(o) raise OverflowError("result out of range") return NotImplemented @@ -2024,10 +2024,10 @@ class datetime(date): hour, rem = divmod(delta.seconds, 3600) minute, second = divmod(rem, 60) if 0 < delta.days <= _MAXORDINAL: - return datetime.combine(date.fromordinal(delta.days), - time(hour, minute, second, - delta.microseconds, - tzinfo=self._tzinfo)) + return type(self).combine(date.fromordinal(delta.days), + time(hour, minute, second, + delta.microseconds, + tzinfo=self._tzinfo)) raise OverflowError("result out of range") __radd__ = __add__ |