Guido van Rossum <gu...@python.org> added the comment: On Thu, Mar 8, 2012 at 4:56 PM, STINNER Victor <rep...@bugs.python.org> wrote: > > STINNER Victor <victor.stin...@gmail.com> added the comment: > >> Can you implement the counter without adding an extra field to the dict >> object? > > Add a counter requires to change the prototype of the C lookup function: > PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, Py_hash_t hash); > > I don't know if it is a problem for ABI compatibility or extension > modules. I suppose that it is safer and simpler to not change it :-)
Agreed. >> I worry that we'll get the same objection we had when MAL proposed collision >>counting as a solution to the hash DoS attack. >> >> The numbers 0, 1 and infinity are special; all others are to be treated with >> skepticism. > > Is it really useful to only retry once? Retrying once means that it > would work in most cases, but not in some corner cases. For example, > retrying once may hide the problem if you have only 1 client (1 > thread), but you get the exception when you have more clients (more > threads). > > Or do I misunderstand the problem? Sorry, I was joking; anyway, 1 in this context would mean do the lookup exactly once (so 0 would mean not to do it at all). One retry would effectively mean try it twice, which would have to be treated skeptically. :-) Given all this I think we should keep it as you have committed and add it to the docs and whatsnew. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14205> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com