[issue15973] Segmentation fault on timezone comparison

Stefan Krah report at bugs.python.org
Wed Sep 19 21:26:45 CEST 2012


Stefan Krah added the comment:

The segfault does not occur in a debug build. The stack trace
suggests that timezone_richcompare() accesses other->offset
of the None object:

(gdb) f 2
#2  0x000000000041d4e9 in do_richcompare (v=None, w=<datetime.timezone at remote 0x7ffff6688ab0>, 
    op=<value optimized out>) at Objects/object.c:563
563             res = (*f)(w, v, _Py_SwappedOp[op]);
(gdb) f 1
#1  timezone_richcompare (self=0x7ffff6688ab0, other=<value optimized out>, op=2)
    at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:3218
3218        return delta_richcompare(self->offset, other->offset, op);
(gdb) l
3213    timezone_richcompare(PyDateTime_TimeZone *self,
3214                         PyDateTime_TimeZone *other, int op)
3215    {
3216        if (op != Py_EQ && op != Py_NE)
3217            Py_RETURN_NOTIMPLEMENTED;
3218        return delta_richcompare(self->offset, other->offset, op);
3219    }
3220
3221    static Py_hash_t
3222    timezone_hash(PyDateTime_TimeZone *self)
(gdb) f 0
#0  0x00007ffff5d850cf in delta_richcompare (self=0x7ffff6688ab0, other=<value optimized out>, op=2)
    at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:1823
1823        if (PyDelta_Check(other)) {

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15973>
_______________________________________


More information about the Python-bugs-list mailing list