Problem with OrderedDict

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed May 30 08:59:11 EDT 2018


On Wed, 30 May 2018 10:48:06 +0200, Frank Millman wrote:

> So my first question is, what is the difference between the two error
> messages? I am using an OrderedDict for my test as well, so the
> difference is not caused by using a normal dictionary.

>From Object/orderdict.c I find:

    /* Check for unsupported changes. */
    if (di->di_odict->od_state != di->di_state) {
        PyErr_SetString(PyExc_RuntimeError,
                        "OrderedDict mutated during iteration");
        goto done;
    }
    if (di->di_size != PyODict_SIZE(di->di_odict)) {
        PyErr_SetString(PyExc_RuntimeError,
                        "OrderedDict changed size during iteration");
        di->di_size = -1; /* Make this state sticky */
        return NULL;
    }


but I have no idea what that means :-)



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list