You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Difference in equality check between C and Python implementation for datetime module's timedelta and time #81760
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-07-14.10:04:38.808>created_at=<Date2019-07-13.05:25:41.676>labels= ['3.7', '3.8', 'type-bug', 'library', '3.9']
title="Difference in equality check between C and Python implementation for datetime module's timedelta and time"updated_at=<Date2019-07-25.21:16:37.867>user='https://github.com/tirkarthi'
New changeset e6b46aa by Paul Ganssle (Xtreak) in branch 'master': bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726) e6b46aa
New changeset 143672c by Miss Islington (bot) in branch '3.8': bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726) 143672c
New changeset c6b3106 by Miss Islington (bot) (Xtreak) in branch '3.7':
[3.7] bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726) (GH-14745) c6b3106
Activity
tirkarthi commentedon Jul 13, 2019
As reported by Serhiy on https://bugs.python.org/issue37555#msg347733 there is a difference in __eq__ definition in datetime module's C and Python implementation for timedelta and time. When the other in __eq__ is not of the same type NotImplemented is not returned in Python implementation like C causing equality to behave differently.
Difference in C implementation and Python implementation for datetime.timedelta.__eq__
cpython/Modules/_datetimemodule.c
Line 2152 in c8e7146
cpython/Lib/datetime.py
Line 732 in c8e7146
I will add a PR for this with test.
serhiy-storchaka commentedon Jul 13, 2019
Do you mind to fix also other similar cases if they are? __lt__ and others should have the same property.
pganssle commentedon Jul 13, 2019
New changeset e6b46aa by Paul Ganssle (Xtreak) in branch 'master':
bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)
e6b46aa
miss-islington commentedon Jul 13, 2019
New changeset 143672c by Miss Islington (bot) in branch '3.8':
bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)
143672c
miss-islington commentedon Jul 14, 2019
New changeset c6b3106 by Miss Islington (bot) (Xtreak) in branch '3.7':
[3.7] bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726) (GH-14745)
c6b3106
serhiy-storchaka commentedon Jul 25, 2019
See bpo-37685.