From 201720a3717426c33ff114b3169ac6d7d29de2c0 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 13 Sep 2021 12:38:36 +0300 Subject: Fix for Python 3.10: TypeError: 'decimal.Decimal' object cannot be interpreted as an integer --- src/isodate/duration.py | 8 ++++++-- 1 file 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 -- cgit v1.2.1