@@ -2710,6 +2710,9 @@ def __add__(self, other):
27102710 return self .apply (other )
27112711 except ApplyTypeError :
27122712 return NotImplemented
2713+ except OverflowError :
2714+ raise OverflowError ("the add operation between {} and {} "
2715+ "will overflow" .format (self , other ))
27132716
27142717 def __eq__ (self , other ):
27152718 if isinstance (other , compat .string_types ):
@@ -2748,14 +2751,26 @@ def nanos(self):
27482751
27492752 def apply (self , other ):
27502753 # Timestamp can handle tz and nano sec, thus no need to use apply_wraps
2751- if isinstance (other , (datetime , np .datetime64 , date )):
2754+ if isinstance (other , Timestamp ):
2755+
2756+ # in order to avoid a recursive
2757+ # call of __add__ and __radd__, when we
2758+ # call using the + operator, we directly
2759+ # call the known metho, as this by definition is
2760+ # a Timestamp
2761+ result = other .__add__ (self )
2762+ if result == NotImplemented :
2763+ raise OverflowError
2764+ return result
2765+ elif isinstance (other , (datetime , np .datetime64 , date )):
27522766 return as_timestamp (other ) + self
2767+
27532768 if isinstance (other , timedelta ):
27542769 return other + self .delta
27552770 elif isinstance (other , type (self )):
27562771 return type (self )(self .n + other .n )
2757- else :
2758- raise ApplyTypeError ('Unhandled type: %s' % type (other ).__name__ )
2772+
2773+ raise ApplyTypeError ('Unhandled type: %s' % type (other ).__name__ )
27592774
27602775 _prefix = 'undefined'
27612776
0 commit comments