mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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.
(cherry picked from commit 17e52649c0
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
4e402d37eb
commit
dde944f9df
7 changed files with 107 additions and 84 deletions
|
@ -3744,11 +3744,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue