
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-07-13 05:25 byxtreak, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 14726 | merged | xtreak,2019-07-13 05:36 | |
| PR 14743 | merged | miss-islington,2019-07-13 13:37 | |
| PR 14745 | merged | xtreak,2019-07-13 13:43 | |
| Messages (6) | |||
|---|---|---|---|
| msg347773 -(view) | Author: Karthikeyan Singaravelan (xtreak)*![]() | Date: 2019-07-13 05:25 | |
As reported by Serhiy onhttps://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__https://github.com/python/cpython/blob/c8e7146de257930ea8d0d4aa74b3a64fcaa79d4b/Modules/_datetimemodule.c#L2152static PyObject *delta_richcompare(PyObject *self, PyObject *other, int op){ if (PyDelta_Check(other)) { int diff = delta_cmp(self, other); return diff_to_bool(diff, op); } else { Py_RETURN_NOTIMPLEMENTED; }}https://github.com/python/cpython/blob/c8e7146de257930ea8d0d4aa74b3a64fcaa79d4b/Lib/datetime.py#L732def __eq__(self, other): if isinstance(other, timedelta): return self._cmp(other) == 0 else: return FalseI will add a PR for this with test. | |||
| msg347813 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-07-13 13:15 | |
Do you mind to fix also other similar cases if they are? __lt__ and others should have the same property. | |||
| msg347815 -(view) | Author: Paul Ganssle (p-ganssle)*![]() | Date: 2019-07-13 13:22 | |
New changesete6b46aafad3427463d6264a68824df4797e682f1 by Paul Ganssle (Xtreak) in branch 'master':bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)https://github.com/python/cpython/commit/e6b46aafad3427463d6264a68824df4797e682f1 | |||
| msg347821 -(view) | Author: miss-islington (miss-islington) | Date: 2019-07-13 13:59 | |
New changeset143672cf028740fc549e532c049559c522930c95 by Miss Islington (bot) in branch '3.8':bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)https://github.com/python/cpython/commit/143672cf028740fc549e532c049559c522930c95 | |||
| msg347903 -(view) | Author: miss-islington (miss-islington) | Date: 2019-07-14 10:14 | |
New changesetc6b31061997526b31961ec34328408ca421f51fc 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)https://github.com/python/cpython/commit/c6b31061997526b31961ec34328408ca421f51fc | |||
| msg348454 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-07-25 21:16 | |
Seeissue37685. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:18 | admin | set | github: 81760 |
| 2019-07-25 21:16:37 | serhiy.storchaka | set | messages: +msg348454 |
| 2019-07-14 10:14:03 | miss-islington | set | messages: +msg347903 |
| 2019-07-14 10:04:38 | p-ganssle | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-07-13 13:59:40 | miss-islington | set | nosy: +miss-islington messages: +msg347821 |
| 2019-07-13 13:43:16 | xtreak | set | pull_requests: +pull_request14541 |
| 2019-07-13 13:37:44 | miss-islington | set | pull_requests: +pull_request14539 |
| 2019-07-13 13:22:25 | p-ganssle | set | messages: +msg347815 |
| 2019-07-13 13:15:52 | serhiy.storchaka | set | messages: +msg347813 |
| 2019-07-13 05:36:56 | xtreak | set | keywords: +patch stage: patch review pull_requests: +pull_request14522 |
| 2019-07-13 05:25:41 | xtreak | create | |