Skip to content

Commit 23eb6c2

Browse files
committed
remove if statement to always raise the exception on TypeERror
1 parent 25286eb commit 23eb6c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,11 +1501,10 @@ def __rsub__(self, other):
15011501
try:
15021502
return -(datetime_result)
15031503
except TypeError as e:
1504-
if isinstance(datetime_result, DatetimeArray):
1505-
raise TypeError(
1506-
"Unsupported operand type(s) for -: "
1507-
f"'{type(self).__name__}' and '{type(other).__name__}'"
1508-
) from e
1504+
raise TypeError(
1505+
"Unsupported operand type(s) for -: "
1506+
f"'{type(self).__name__}' and '{type(other).__name__}'"
1507+
) from e
15091508

15101509
def __iadd__(self, other) -> Self:
15111510
result = self + other

0 commit comments

Comments
 (0)