diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-08-04 09:38:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-04 09:38:46 (GMT) |
commit | 17e52649c0e7e9389f1cc2444a53f059e24e6bca (patch) | |
tree | 2cfdcdaefd375aaf93ef6973f507ffb768ee5472 /Modules | |
parent | 5c72badd06a962fe0018ceb9916f3ae66314ea8e (diff) | |
download | cpython-17e52649c0e7e9389f1cc2444a53f059e24e6bca.zip cpython-17e52649c0e7e9389f1cc2444a53f059e24e6bca.tar.gz cpython-17e52649c0e7e9389f1cc2444a53f059e24e6bca.tar.bz2 |
bpo-37685: Fixed comparisons of datetime.timedelta and datetime.timezone. (GH-14996)
There was a discrepancy between the Python and C implementations.
Add singletons ALWAYS_EQ, LARGEST and SMALLEST in test.support
to test mixed type comparison.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_datetimemodule.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 19d3d7e..b55922c 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -3741,11 +3741,8 @@ timezone_richcompare(PyDateTime_TimeZone *self, { if (op != Py_EQ && op != Py_NE) Py_RETURN_NOTIMPLEMENTED; - if (Py_TYPE(other) != &PyDateTime_TimeZoneType) { - if (op == Py_EQ) - Py_RETURN_FALSE; - else - Py_RETURN_TRUE; + if (!PyTZInfo_Check(other)) { + Py_RETURN_NOTIMPLEMENTED; } return delta_richcompare(self->offset, other->offset, op); } |