diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-09-20 20:39:33 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-09-20 20:39:33 (GMT) |
commit | 3ec153681e4e5553fc6882699beb5af6d45c75e6 (patch) | |
tree | 3c17886d2e7636effa0d7d4b9c7a3b2d1361b61c /Modules | |
parent | 4e12ad19c984dc8dfdb8c326b0ea44c490408579 (diff) | |
download | cpython-3ec153681e4e5553fc6882699beb5af6d45c75e6.zip cpython-3ec153681e4e5553fc6882699beb5af6d45c75e6.tar.gz cpython-3ec153681e4e5553fc6882699beb5af6d45c75e6.tar.bz2 |
Issue #15973: Fixed segmentation fault on timezone comparison to other types.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_datetimemodule.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 8f571ad..444cc00 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -3243,9 +3243,13 @@ static PyObject * timezone_richcompare(PyDateTime_TimeZone *self, PyDateTime_TimeZone *other, int op) { - if (op != Py_EQ && op != Py_NE) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + 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; } return delta_richcompare(self->offset, other->offset, op); } |