mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://bugs.python.org/issue37915 Automerge-Triggered-By: @pablogsal
This commit is contained in:
parent
8889627b53
commit
4be11c009a
3 changed files with 10 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
|||
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType)
|
||||
|
||||
#define PyTimezone_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeZoneType)
|
||||
|
||||
/*[clinic input]
|
||||
module datetime
|
||||
|
@ -3745,7 +3746,7 @@ timezone_richcompare(PyDateTime_TimeZone *self,
|
|||
{
|
||||
if (op != Py_EQ && op != Py_NE)
|
||||
Py_RETURN_NOTIMPLEMENTED;
|
||||
if (!PyTZInfo_Check(other)) {
|
||||
if (!PyTimezone_Check(other)) {
|
||||
Py_RETURN_NOTIMPLEMENTED;
|
||||
}
|
||||
return delta_richcompare(self->offset, other->offset, op);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue