diff options
| author | Georg Brandl <georg@python.org> | 2012-09-22 09:23:12 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2012-09-22 09:23:12 +0200 |
| commit | 0085a2407574a4af46019bee279895bdafbd76b8 (patch) | |
| tree | adfe988557488cc52e34b16bb971f8a8727f1ae6 /Modules/_datetimemodule.c | |
| parent | fd296ff5d6436ad3a782cca816783f05acd9fe78 (diff) | |
| download | cpython-git-0085a2407574a4af46019bee279895bdafbd76b8.tar.gz | |
Closes #15973: fix a segmentation fault when comparing timezone objects.
Diffstat (limited to 'Modules/_datetimemodule.c')
| -rw-r--r-- | Modules/_datetimemodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 6df5c03b97..01c85d1cd3 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -3215,6 +3215,12 @@ 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; + } return delta_richcompare(self->offset, other->offset, op); } |
