[issue16991] Add OrderedDict written in C

Eric Snow report at bugs.python.org
Fri May 22 04:41:03 CEST 2015


Eric Snow added the comment:

I've spent a bit of time exploring the segfault.  Here's some data that might help relative to the configparser test.

I put the following at the beginning of _odict_resize:

    Py_ssize_t len = PyObject_Size((PyObject *)od);
    if (len == 0)
        PySys_FormatStdout(".");
    else {
        if (((PyDictObject *)od)->ma_keys->dk_size < od->od_size)
            PySys_FormatStdout("-");
        if (len < 10)
            PySys_FormatStdout("%d", len);
        else
            PySys_FormatStdout("+");
    }
    if (len >= 10)
        PySys_FormatStdout("%d\n", len);

If the current item count is 0 then it prints a dot.  If the resize is shrinking then it prints a - (this did not happen).  Otherwise the odict is growing and it prints the current item count.  Multi-digit numbers are preceded by + and followed by a newline.

I've included the results of different hash seeds (0/no randomization, 1, and 7).  You'll notice how the results are subtly different.  In the case of 7, it matches no randomization up to the point that it segfaults.  I got the same results with 15.  However, 35 fails right after the second +22.

$ PYTHONHASHSEED=0 ./python -m test.regrtest -m test_basic test_configparser
...6+12
+22
....6+12
+22
........6.6........+10
........6.6........+10
........6.6........+10
........6.6........+10
........6.6........+10
.+10
........6.6........+10
........6.6........+10
........6.6........+10
........6.6...............6..6............+10
....6.6.6.6.66.66.6.6.6.6.+12
6.+12
6.6.6.6.6.6.6.6.6.+22
6.+22
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.+44
6.+44
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.+86
6.+86
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6........6.6........+10
........6.6........+10
........6.6........+10
........6.6........+10
.6..

$ PYTHONHASHSEED=1 ./python -m test.regrtest -m test_basic test_configparser
...6+12
+22
....6+12
+22
........6.6................6.6................6.6................6.6................6.6.........+11
........6.6................6.6................6.6................6.6...............6..6................6.6.6.6.66.66.6.6.6.6.+12
6.+12
6.6.6.6.6.6.6.6.6.+22
6.+22
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.+44
6.+44
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.+86
6.+86
6.6.6.6.6.6.6.6.6.6.6.6.6.6.6........6.6................6.6................6.6................6.6.........6..

$ PYTHONHASHSEED=7 ./python -m test.regrtest -m test_basic test_configparser
...6+12
+22
....6+12
+22
........6.6........+10
........6.6........+10
........6.6........+10
........6.6........+10
........6.6........+10
.+10
Fatal Python error: Segmentation fault

----------

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


More information about the Python-bugs-list mailing list