summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2021-09-13 12:38:36 +0300
committerHugo van Kemenade <hugovk@users.noreply.github.com>2021-09-13 12:38:36 +0300
commit201720a3717426c33ff114b3169ac6d7d29de2c0 (patch)
tree3a0a7a66dbbaffad1219f7b7920a609dd5efeb5c
parent40d929fbb26bf44222fa44d0ff10a675d0eb1adc (diff)
downloadisodate-201720a3717426c33ff114b3169ac6d7d29de2c0.tar.gz
Fix for Python 3.10: TypeError: 'decimal.Decimal' object cannot be interpreted as an integer
-rw-r--r--src/isodate/duration.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/isodate/duration.py b/src/isodate/duration.py
index 6d1848c..4b83e45 100644
--- a/src/isodate/duration.py
+++ b/src/isodate/duration.py
@@ -180,7 +180,9 @@ class Duration(object):
newday = maxdays
else:
newday = other.day
- newdt = other.replace(year=newyear, month=newmonth, day=newday)
+ newdt = other.replace(
+ year=int(newyear), month=int(newmonth), day=int(newday)
+ )
# does a timedelta + date/datetime
return self.tdelta + newdt
except AttributeError:
@@ -264,7 +266,9 @@ class Duration(object):
newday = maxdays
else:
newday = other.day
- newdt = other.replace(year=newyear, month=newmonth, day=newday)
+ newdt = other.replace(
+ year=int(newyear), month=int(newmonth), day=int(newday)
+ )
return newdt - self.tdelta
except AttributeError:
# other probably was not compatible with data/datetime