[issue14071] allow more than one hash seed per process (move _Py_HashSecret into PyInterpreterState)

STINNER Victor report at bugs.python.org
Tue Feb 21 22:44:16 CET 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

I'm not sure that it could work because many C functions use caches using static variables.

Just a random example:
int
_PyUnicode_HasNULChars(PyObject* s)
{
    static PyObject *nul = NULL;

    if (nul == NULL)
        nul = PyUnicode_FromStringAndSize("\0", 1);
    if (nul == NULL)
        return -1;
    return PyUnicode_Contains(s, nul);
}

If hash(nul) is computed in an interpreter, the same hash value will be used by all interpreters. If interpreters use a different hash secret, you will have a problem.

----------
nosy: +haypo

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


More information about the Python-bugs-list mailing list