Skip to content

Commit 0832b28

Browse files
committed
Fix pandas timedelta addition
1 parent 7483b9f commit 0832b28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graalpython/lib-python/3/datetime.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,9 @@ def __add__(self, other):
21782178
"Add a datetime and a timedelta."
21792179
if not isinstance(other, timedelta):
21802180
return NotImplemented
2181+
# GraalPy change: if it's a subtype, use only the values, don't call into the possibly overridden addition
2182+
if not type(other) is timedelta:
2183+
other = timedelta(days=other.days, seconds=other.seconds, microseconds=other.microseconds)
21812184
delta = timedelta(self.toordinal(),
21822185
hours=self._hour,
21832186
minutes=self._minute,

0 commit comments

Comments
 (0)