homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: allow more than one hash seed per process (move _Py_HashSecret into PyInterpreterState)
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: grahamd, gregory.p.smith, pitrou, vstinner
Priority: normal Keywords:

Created on 2012年02月21日 06:54 by gregory.p.smith, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (4)
msg153855 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012年02月21日 06:54
The newly added hash randomization seed (issue 13703) is a global defined in object/object.c that is initialized only once within a process by a call from Py_InitializeEx().
For applications embedding Python interpreters it may be useful for them to NOT share a hash randomization seed across all interpreter instances within that process. That way long living processes or processes serving many independent tasks can avoid using the same hash seed for separate tasks.
msg153902 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012年02月21日 21:44
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.
msg154076 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年02月23日 18:11
Agreed with Victor, this is not really doable currently.
Besides, you can't really have several interpreter instances simultaneously, you can have several sub-interpreters, which isn't exactly the same thing (sub-interpreters share some stuff, I don't remember which exactly).
msg154986 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012年03月05日 22:47
I close the issue as wontfix because of technical issues. Reopen it if you have an idea to solve them.
History
Date User Action Args
2022年04月11日 14:57:26adminsetgithub: 58279
2012年03月05日 22:47:16vstinnersetstatus: open -> closed
resolution: wont fix
messages: + msg154986
2012年02月23日 18:11:01pitrousetnosy: + pitrou
messages: + msg154076
2012年02月21日 21:44:15vstinnersetnosy: + vstinner
messages: + msg153902
2012年02月21日 12:53:04pitrousetnosy: + grahamd
2012年02月21日 06:54:46gregory.p.smithcreate

AltStyle によって変換されたページ (->オリジナル) /