Inconsistent relativedelta args checking
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dateutil |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
current relativedelta.
File "/usr/local/
if dt1 < dt2:
TypeError: can't compare FakeDatetime to datetime.date
current checking is
if (not isinstance(dt1, datetime.date)) or (not isinstance(dt2, datetime.date)):
raise TypeError(
if not type(dt1) == type(dt2) # isinstance(dt2, type(dt1)):
if not isinstance(dt1, datetime.datetime):
dt1 = datetime.
if not isinstance(dt2, datetime.datetime):
dt2 = datetime.
I think a more consistent one, using always isinstance(), could be:
if (not isinstance(dt1, datetime.date)) or (not isinstance(dt2, datetime.date)):
raise TypeError(
if not isinstance(dt1, type(dt2)):
if not isinstance(dt1, datetime.datetime):
dt1 = datetime.
else:
dt2 = datetime.
Hi,
I believe I fixed this in current 'master' (which will be released some time AFTER 2.3)
https:/ /github. com/dateutil/ dateutil/ commit/ db29c6d669e3809 993b1a973a16712 46f81fcb0a