From a6ee1d30ff0893002f7ded37b1604fc7fa56100f Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Mon, 29 Jan 2024 13:08:40 +0100 Subject: [PATCH] Deprecate Date arithmetic with tuples --- SWIG/date.i | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SWIG/date.i b/SWIG/date.i index 3e7649db0..cdcc19c0d 100644 --- a/SWIG/date.i +++ b/SWIG/date.i @@ -829,11 +829,15 @@ Date._old___add__ = Date.__add__ Date._old___sub__ = Date.__sub__ def Date_new___add__(self,x): if type(x) is tuple and len(x) == 2: + from warnings import warn + warn(f'adding a tuple to a Date is deprecated; use a Period instance', FutureWarning, stacklevel=2) return self._old___add__(Period(x[0],x[1])) else: return self._old___add__(x) def Date_new___sub__(self,x): if type(x) is tuple and len(x) == 2: + from warnings import warn + warn(f'subtracting a tuple from a Date is deprecated; use a Period instance', FutureWarning, stacklevel=2) return self._old___sub__(Period(x[0],x[1])) else: return self._old___sub__(x)