From 40358ac82b948ea8377d5ca32b576def31b39a84 Mon Sep 17 00:00:00 2001
From: Jose Eduardo <jose.eduardo.gd@gmail.com>
Date: Fri, 19 Jul 2019 16:21:56 +0100
Subject: [PATCH 1/8] Avoid unclosed file warning

---
 setup.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index e39446f..9634625 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,8 @@
 
 
 def read(*rnames):
-    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+    with open(os.path.join(os.path.dirname(__file__), *rnames)) as read_file:
+        return read_file.read()
 
 
 setup(name='isodate',

From 91bf24dd1610d5f6ac5d4867457f0703046017d2 Mon Sep 17 00:00:00 2001
From: Jose Eduardo <jose.eduardo.gd@gmail.com>
Date: Fri, 19 Jul 2019 16:22:22 +0100
Subject: [PATCH 2/8] Raise warnings produced by isodate as errors during tests

---
 src/isodate/tests/__init__.py | 3 +++
 tox.ini                       | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/isodate/tests/__init__.py b/src/isodate/tests/__init__.py
index b1d46bd..7208cbd 100644
--- a/src/isodate/tests/__init__.py
+++ b/src/isodate/tests/__init__.py
@@ -29,6 +29,7 @@
 '''
 
 import unittest
+import warnings
 from isodate.tests import (test_date, test_time, test_datetime, test_duration,
                            test_strf, test_pickle)
 
@@ -37,6 +38,8 @@ def test_suite():
     '''
     Return a new TestSuite instance consisting of all available TestSuites.
     '''
+    warnings.filterwarnings("error", module=r"isodate(\..)*")
+
     return unittest.TestSuite([
         test_date.test_suite(),
         test_time.test_suite(),

From fc0fb3278da5f463ca5b2f0a3acafbbf2869bd7a Mon Sep 17 00:00:00 2001
From: Jose Eduardo <jose.eduardo.gd@gmail.com>
Date: Fri, 19 Jul 2019 16:29:43 +0100
Subject: [PATCH 4/8] Fix Python 3.8 DeprecationWarning

Ref: https://docs.python.org/3.8/whatsnew/3.8.html

> Many builtin and extension functions that take integer arguments will
> now emit a deprecation warning for Decimals, Fractions and any other
> objects that can be converted to integers only with a loss (e.g. that
> have the `__int__()` method but do not have the `__index__()` method).
> In future version they will be errors. (Contributed by Serhiy
> Storchaka in bpo-36048.)
---
 src/isodate/duration.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/isodate/duration.py b/src/isodate/duration.py
index 6d1848c..d923cee 100644
--- a/src/isodate/duration.py
+++ b/src/isodate/duration.py
@@ -180,7 +180,7 @@ def __add__(self, other):
                 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=newday)
             # does a timedelta + date/datetime
             return self.tdelta + newdt
         except AttributeError:
@@ -264,7 +264,7 @@ def __rsub__(self, other):
                 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=newday)
             return newdt - self.tdelta
         except AttributeError:
             # other probably was not compatible with data/datetime
