commit | 0085a2407574a4af46019bee279895bdafbd76b8 | [log] [tgz] |
---|---|---|
author | Georg Brandl <georg@python.org> | Sat Sep 22 09:23:12 2012 +0200 |
committer | Georg Brandl <georg@python.org> | Sat Sep 22 09:23:12 2012 +0200 |
tree | adfe988557488cc52e34b16bb971f8a8727f1ae6 | |
parent | fd296ff5d6436ad3a782cca816783f05acd9fe78 [diff] [blame] |
Closes #15973: fix a segmentation fault when comparing timezone objects.
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 6df5c03..01c85d1 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c
@@ -3215,6 +3215,12 @@ { 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); }